2.8 KiB
07 — Compilation-database compatibility provider
Status: PLANNED; no implementation claim Requirements: R-007,R-009,R-010 Dependencies: 04,05; may implement in parallel with06 after shared model freeze.
Ownership and boundaries
Proposed Sol: NEW src/build/compdb/, include/vls/build/compdb/, tests/build/compdb/ and fixtures. No writes to database producer. Future assignments must verify the then-current baseline and exact disjoint paths; these proposed scopes do not authorize work in another repository.
Contracts and data flow
Read directory/file/arguments or command and optional output per the official schema. Prefer arguments, preserve multiple entries, resolve relative operands against directory, and retain original provenance. Compiler-specific response-file expansion is bounded and contributes content identity. No shell evaluation.
Implementation sequence
- Parse complete JSON through bounded ingestion, validate known field types and preserve extra fields without pretending they are standard build metadata.
- Implement POSIX command tokenization for the Linux release and explicit driver selection; reject unsupported quoting/dialects rather than guess shell semantics.
- Normalize known driver flags, recursively expand response files with cycle/depth/byte limits, then classify execution-bearing options under04.
- Observe replacement/content changes, publish a complete new provider generation and retain the previous one as stale on errors. Provide explicit database/alternative selection.
Failure behavior and constraints
Missing files, malformed JSON/commands, ambiguous driver dialect, unavailable response files and execution-bearing flags yield contextual errors. Native target/module/environment/readiness data absent from the schema stays unknown. Invalid explicit VBS selection does not silently switch to an unrelated database.
Acceptance scenarios
- Cover paths/spaces/Unicode/quotes, arguments preference, command escapes, multiple entries, relative directories and optional output.
- Test nested/cyclic/changed response files and plugin/wrapper markers without any shell execution.
- Test atomic replacements, partial writes, file deletion and deterministic alternative selection with real CMake-exported fixtures.
Verification and integration
Proposed NEW CTest label: compdb. Once implemented, register a nonzero suite and run:
dev cpp-gcc -c ctest --test-dir build/bootstrap -L compdb --output-on-failure
This future command is not evidence that the label/tests exist now. Before dispatch, bind the fixtures above to actual targets and record prerequisites/side effects. Require fresh independent review of the implemented contract and affected integrations. Provider selection can return to the last verified database generation with stale status. Never rewrite a user-owned compile_commands.json or normalize it in place.