C++: Add BMN extractor - #22688
Open
paldepind wants to merge 6 commits into
Open
C++: Add BMN extractor#22688paldepind wants to merge 6 commits into
paldepind wants to merge 6 commits into
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Extraction failure propagation, overlay invalidation, source discovery, and dependency-installation issues can produce incomplete or misleading extraction results.
Review effort: Balanced
Findings: 2
Open (5)
Report extraction failure when commands cannot launch or succeed · New Handle deleted headers when computing overlay dependency changes · New Deduplicate package installation attempts before invoking installer · New Allow whitespace between # and include in preprocessing directives · New Recognize uppercase C and C++ source file extensions · New
What changed in this PR
Moves the C/C++ build-mode-none Rust extractor into the public CodeQL repository and integrates it with existing build, test, lint, and CI infrastructure.
Changes:
- Imports the extractor, unit tests, fixtures, and developer documentation.
- Adds Cargo and Bazel targets with a dedicated generated Rust dependency universe.
- Adds CI and repository-wide lint/dependency-update integration.
| File | Description |
|---|---|
.github/workflows/cpp-bmn.yml |
Adds Cargo and Bazel CI. |
.pre-commit-config.yaml |
Registers BMN linting. |
MODULE.bazel |
Registers BMN Rust repositories. |
lint |
Runs the BMN linter. |
cpp/extractor/bmn/.gitignore |
Ignores Cargo artifacts. |
cpp/extractor/bmn/BUILD.bazel |
Defines binary and test targets. |
cpp/extractor/bmn/Cargo.lock |
Locks Rust dependencies. |
cpp/extractor/bmn/Cargo.toml |
Defines the Rust package. |
cpp/extractor/bmn/FILE_FILTERING.md |
Documents file filtering. |
cpp/extractor/bmn/README.md |
Documents development workflows. |
cpp/extractor/bmn/lint |
Runs formatting and Clippy checks. |
cpp/extractor/bmn/src/compiler.rs |
Discovers and represents compilers. |
cpp/extractor/bmn/src/dependency_installation.rs |
Installs inferred packages. |
cpp/extractor/bmn/src/directory_tree.rs |
Models project files. |
cpp/extractor/bmn/src/environment.rs |
Reads extraction environment settings. |
cpp/extractor/bmn/src/extraction_command_runner.rs |
Executes extraction commands. |
cpp/extractor/bmn/src/file_filter.rs |
Implements source filtering. |
cpp/extractor/bmn/src/gnu_compiler_default_include_finder.rs |
Discovers compiler include paths. |
cpp/extractor/bmn/src/include_finder.rs |
Resolves include dependencies. |
cpp/extractor/bmn/src/include_scanner.rs |
Parses include directives. |
cpp/extractor/bmn/src/logger.rs |
Configures logging. |
cpp/extractor/bmn/src/main.rs |
Orchestrates extraction. |
cpp/extractor/bmn/src/overlays.rs |
Selects overlay dependencies. |
cpp/extractor/bmn/src/package_database.rs |
Queries package metadata. |
cpp/extractor/bmn/src/path_utils.rs |
Provides path utilities. |
cpp/extractor/bmn/src/project_definitions.rs |
Discovers project sources. |
cpp/extractor/bmn/src/telemetry.rs |
Emits extraction telemetry. |
cpp/extractor/bmn/src/test_utils.rs |
Provides test helpers. |
cpp/extractor/bmn/src/timing.rs |
Records operation timings. |
cpp/extractor/bmn/tests/resources/** |
Adds 24 extractor test fixtures. |
misc/bazel/3rdparty/BUILD.bazel |
Defines dependency generation. |
misc/bazel/3rdparty/cpp_bmn_deps_extension.bzl |
Exposes generated repositories. |
misc/bazel/3rdparty/cpp_bmn_deps/BUILD.bazel |
Configures crate vendoring. |
misc/bazel/3rdparty/cpp_bmn_deps/alias_rules.bzl |
Defines generated aliases. |
misc/bazel/3rdparty/cpp_bmn_deps/crates.bzl |
Registers vendored crates. |
misc/bazel/3rdparty/cpp_bmn_deps/defs.bzl |
Defines generated dependencies. |
misc/bazel/3rdparty/cpp_bmn_deps/BUILD.*.bazel |
Adds 163 generated crate targets. |
misc/bazel/3rdparty/update_cargo_deps.sh |
Includes BMN dependency updates. |
misc/bazel/3rdparty/update_cpp_bmn_deps.sh |
Regenerates BMN dependencies. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
paldepind
force-pushed
the
cpp/bmn-extractor-move
branch
from
September 29, 2026 06:30
607dcbb to
716347f
Compare
Adds the sources of the internal C++ BMN extractor. All files are verbatim copies of what exists internally (some might say that they are byte-for-byte identical but I'll refrain from using that phrase).
Add a script for generating vendored dependencies for the C++ BMN extractor. The setup and approach is identical to what we already use for existing Rust-based extractors.
Check in the vendored dependencies. All files in this commit are auto-generated.
Add a Bazel target for the C/C++ BMN extractor. This required a change in `cpp/extractor/bmn/src/test_utils.rs` since using `$CARGO_MANIFEST_DIR` doesn't work when invoking that target from the internal repo.
The updated Rust toolchain introduced additional Clippy lints. This fixes the lints.
Run Cargo and Bazel checks when the build-mode-none extractor changes, integrate its Rust lint into pre-commit, and document the standalone development workflow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
paldepind
force-pushed
the
cpp/bmn-extractor-move
branch
from
September 29, 2026 07:11
716347f to
a52b319
Compare
paldepind
marked this pull request as ready for review
September 29, 2026 08:03
This branch has not been deployed
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.


This PR moves the C/C++ build-mode-none extractor to
cpp/extractor/bmnin this repo.This open sources the BMN extractor.
I recommend a per-commit review. The commit message on each commit should explain what's going on.
A dependent PR on the internal repo deletes the migrated implementation and adjust the build system. The PR also has a few other details, and they should be reviewed in tandem.