Build, test, and benchmark the Ada WHATWG-compliant URL parser library using CMake. Includes clang-tidy static analysis and development workflow guidance.
You are assisting with development of the Ada URL parser library - a WHATWG-compliant, high-performance URL parser written in modern C++20. This skill provides comprehensive guidance for building, testing, benchmarking, and analyzing the codebase.
1. **Development checks are for correctness, not performance**: Tests should run with assertions enabled. Benchmarks must disable them.
2. **Ninja builds faster than Make**: Prefer `-G Ninja` for all builds when available.
3. **Separate build directories**: Use different directories for test builds vs benchmark builds to avoid constant reconfiguration.
4. **Clang-tidy requires clang++**: Static analysis must use clang++ compiler to avoid GCC-specific flag conflicts.
For minimal builds:
```bash
cmake -B build -G Ninja
cmake --build build
```
For active development with correctness validation:
```bash
cmake -B build -G Ninja -DADA_TESTING=ON
cmake --build build
ctest --output-on-failure --test-dir build
```
**Important**: Development checks (assertions via `ADA_ASSERT_TRUE`, `ADA_ASSERT_EQUAL`) are automatically enabled with `ADA_TESTING=ON` unless building in Release mode. This validates internal state and catches bugs early.
For accurate performance measurements:
```bash
cmake -B build-bench -G Ninja \
-DADA_BENCHMARKS=ON \
-DADA_USE_UNSAFE_STD_REGEX_PROVIDER=ON \
-DCMAKE_BUILD_TYPE=Release
cmake --build build-bench
./build-bench/benchmarks/benchdata
```
**Critical**: Always use `-DCMAKE_BUILD_TYPE=Release` for benchmarks. Development checks add significant overhead that produces misleading performance data.
| Option | Default | Purpose |
|--------|---------|---------|
| `ADA_TESTING` | OFF | Build test suite |
| `ADA_BENCHMARKS` | OFF | Build benchmarks (requires 64-bit) |
| `ADA_TOOLS` | OFF | Build CLI tools |
| `ADA_BUILD_SINGLE_HEADER_LIB` | OFF | Use amalgamated single-header build |
| `ADA_USE_SIMDUTF` | OFF | Enable SIMD Unicode acceleration |
| `CMAKE_BUILD_TYPE` | - | `Release` (optimized) or `Debug` (development) |
| `CPM_USE_LOCAL_PACKAGES` | OFF | Use system-installed dependencies |
After building with `ADA_TESTING=ON`:
```bash
ctest --output-on-failure --test-dir build
./build/tests/basic_tests
ctest --verbose --test-dir build
```
Tests run with development checks **enabled by default** (assertions active, internal validation occurring). This is the recommended development mode.
Available benchmark executables after building with `ADA_BENCHMARKS=ON`:
```bash
./build-bench/benchmarks/benchdata
./build-bench/benchmarks/bench # Basic URL parsing
./build-bench/benchmarks/bbc_bench # BBC URLs dataset
./build-bench/benchmarks/wpt_bench # Web Platform Tests
./build-bench/benchmarks/percent_encode # Encoding performance
```
**Never benchmark with development checks enabled.** The `ADA_DEVELOPMENT_CHECKS` macro is automatically disabled when building with `-DCMAKE_BUILD_TYPE=Release` or when `NDEBUG` is defined.
Run clang-tidy automatically on each file during compilation:
```bash
cmake -B build -G Ninja \
-DADA_TESTING=ON \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_CLANG_TIDY=clang-tidy \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build build
```
**Critical**: Must use `clang++` compiler. Using GCC will fail because clang-tidy doesn't understand GCC-specific compiler flags like `-mno-avx256-split-unaligned-load`.
First generate compilation database:
```bash
cmake -B build -G Ninja \
-DADA_TESTING=ON \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build build
```
Then run clang-tidy on specific files:
```bash
clang-tidy -p build src/ada.cpp
clang-tidy -p build src/ada_idna.cpp
```
The `-p build` flag references the `compile_commands.json` database.
The `.clang-tidy` file in the project root configures enabled checks:
```bash
cd /path/to/ada
cmake -B build -G Ninja -DADA_TESTING=ON
cmake --build build
cmake -B build-bench -G Ninja \
-DADA_BENCHMARKS=ON \
-DCMAKE_BUILD_TYPE=Release
cmake --build build-bench
```
```bash
cmake --build build
ctest --output-on-failure --test-dir build
./build/tests/basic_tests
```
```bash
./build-bench/benchmarks/benchdata
```
```bash
rm -rf build build-bench
cmake -B build -G Ninja -DADA_TESTING=ON
cmake --build build
```
Compile-time assertions that validate:
```bash
cmake -B build -DADA_DEVELOPMENT_CHECKS=1
cmake -B build -DNDEBUG=1
```
Specify configuration during build:
```bash
cmake -B build -DADA_TESTING=ON
cmake --build build --config Release
ctest --output-on-failure --test-dir build --config Release
```
Standard commands as documented above work without modification.
**Cause**: Development checks enabled.
**Solution**: Rebuild with Release mode:
```bash
cmake -B build-bench -G Ninja \
-DADA_BENCHMARKS=ON \
-DCMAKE_BUILD_TYPE=Release
cmake --build build-bench
```
**Expected behavior** - development checks catching bugs. Review assertion message and fix underlying issue.
**Cause**: Benchmarks not built (disabled or 32-bit system).
**Solution**:
```bash
cmake -B build-bench -G Ninja -DADA_BENCHMARKS=ON
cmake --build build-bench
ls build-bench/benchmarks/ # Verify built executables
```
**Cause**: Using GCC compiler with clang-tidy.
**Solution**: Reconfigure with clang++:
```bash
cmake -B build -G Ninja \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_CLANG_TIDY=clang-tidy
```
| Task | Command | Development Checks |
|------|---------|-------------------|
| Library only | `cmake -B build -G Ninja && cmake --build build` | N/A |
| Testing | `cmake -B build -G Ninja -DADA_TESTING=ON && cmake --build build` | ✅ Enabled |
| Benchmarking | `cmake -B build-bench -G Ninja -DADA_BENCHMARKS=ON -DCMAKE_BUILD_TYPE=Release && cmake --build build-bench` | ❌ Disabled |
| Static analysis | `cmake -B build -G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_CLANG_TIDY=clang-tidy && cmake --build build` | ✅ Enabled |
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/ada-url-parser-development/raw