feat: generate compile database without building - #387
Open
wellwei wants to merge 13 commits into
Open
Conversation
Sunrisepeak
requested changes
Aug 8, 2026
… replace - publish_compile_commands: treat a missing CDB (symlink_status type == not_found) as the normal first-build case instead of a fatal error. is_symlink sets ec on missing paths on every standard library (generic ENOENT on libstdc++/libc++, system ERROR_FILE_NOT_FOUND on MSVC), so no compile_commands.json was ever written on fresh workspaces and all CDB-dependent e2e tests failed. - close the existing-CDB ifstream before the atomic replace so Windows MoveFileExW can replace the destination (open handles cause Access denied / sharing violation). - unit tests: escape Windows backslash paths in the entry() JSON helper, write the mtime fixture in binary mode so on-disk bytes match on Windows, and add a regression test for publishing with no prior CDB.
# Conflicts: # tests/unit/test_compile_commands.cpp
Windows CDBs store file paths with backslashes, so `grep 'src/main.cpp'` never matched and the test failed on the Windows e2e shard once the CDB was actually being generated. Match either separator with `[\/]`.
Windows CDBs store paths with JSON-escaped backslashes (src\\main.cpp), so one-separator patterns still missed. Allow one or more separators.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mcpp build --configure-only, reusing the real build plan and existing build selectors while skipping ordinary compilation, linking, BMI cache population, and build-success cache writestests/**/*.cpp, matching[build].flags, and test dev-dependencies in the generated CDB; stage only std and already-cached dependency BMIs needed by language toolingcompile_commands.jsonatomically across platforms, preserve last-known-good files and CDB symlinks, and keep normal build/test publication failures non-fatalbuild.mcpp, resolve/install dependencies or toolchains, and update lock/resolution metadataThis is the independently agreed A part from #379. It intentionally does not add JSON/NDJSON,
idesubcommands, snapshots,mcpp.wire,invalidatedBy, or new selector semantics. It does not close the RFC.Core impact
mcpp test; existing list/build/run behavior remains covered by unit and E2E testsrequireCompileDatabaseflag; default build/test behavior remains warning-onlyTest plan
mcpp build --no-color --no-cacheon macOS ARM64mcpp test --no-color: 70 passed, 0 failedtests/e2e/202_configure_only_cdb.sh: syntax-error source, test/dev-dependency flags, workspace fan-out,-p, no build artifacts/cache, publication failure preservation01,18,35,76,77,90,157,159Refs #379
Refs mcpp-community/mcpp-vscode#5