Skip to content

C++: Add BMN extractor - #22688

Open
paldepind wants to merge 6 commits into
mainfrom
cpp/bmn-extractor-move
Open

paldepind wants to merge 6 commits into
mainfrom
cpp/bmn-extractor-move

Conversation

@paldepind

@paldepind paldepind commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

This PR moves the C/C++ build-mode-none extractor to cpp/extractor/bmn in 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.

Copilot AI balanced review requested due to automatic review settings September 28, 2026 12:55
@paldepind
paldepind requested review from a team as code owners September 28, 2026 12:55
@paldepind
paldepind marked this pull request as draft September 28, 2026 12:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 High severity · 3 Medium severity

Open (5)
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.

Comment thread cpp/extractor/bmn/src/extraction_command_runner.rs
Comment thread cpp/extractor/bmn/src/overlays.rs
Comment thread cpp/extractor/bmn/src/dependency_installation.rs
Comment thread cpp/extractor/bmn/src/include_scanner.rs
Comment thread cpp/extractor/bmn/src/project_definitions.rs
paldepind and others added 6 commits September 29, 2026 08:33
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 paldepind changed the title C++: Move build-mode-none extractor into codeql C++: Add BMN extractor Sep 29, 2026
@paldepind
paldepind force-pushed the cpp/bmn-extractor-move branch from 716347f to a52b319 Compare September 29, 2026 07:11
@paldepind
paldepind marked this pull request as ready for review September 29, 2026 08:03

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants