Skip to content

Commit 002a731

Browse files
authored
Merge pull request #22688 from github/cpp/bmn-extractor-move
C++: Add BMN extractor
2 parents 33dfa65 + 1a6683c commit 002a731

255 files changed

Lines changed: 34991 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/cpp-bmn.yml‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: C/C++ build mode none extractor
2+
3+
on:
4+
pull_request:
5+
paths: &bmn_paths
6+
- "cpp/extractor/bmn/**"
7+
- "misc/bazel/3rdparty/cpp_bmn_deps/**"
8+
- "misc/bazel/3rdparty/cpp_bmn_deps_extension.bzl"
9+
- "misc/bazel/3rdparty/update_cpp_bmn_deps.sh"
10+
- "misc/bazel/3rdparty/BUILD.bazel"
11+
- "misc/bazel/rust.bzl"
12+
- "MODULE.bazel"
13+
- ".github/workflows/cpp-bmn.yml"
14+
push:
15+
branches:
16+
- main
17+
- "rc/*"
18+
paths: *bmn_paths
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
cargo:
25+
runs-on: ubuntu-latest
26+
defaults:
27+
run:
28+
working-directory: cpp/extractor/bmn
29+
steps:
30+
- uses: actions/checkout@v5
31+
- name: Check formatting
32+
run: cargo fmt --check
33+
- name: Check
34+
run: cargo check
35+
- name: Clippy
36+
run: cargo clippy -- -D warnings
37+
- name: Test
38+
run: cargo test
39+
40+
bazel:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v5
44+
- name: Build
45+
run: bazel build //cpp/extractor/bmn:bmn
46+
- name: Test
47+
run: bazel test //cpp/extractor/bmn:tests

‎.pre-commit-config.yaml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,10 @@ repos:
8585
language: system
8686
entry: python3 rust/lint.py
8787
pass_filenames: false
88+
89+
- id: cpp-bmn-lint
90+
name: Run fmt and clippy on C/C++ BMN Rust code
91+
files: ^cpp/extractor/bmn/(.*rs|Cargo.toml)$
92+
language: system
93+
entry: cpp/extractor/bmn/lint --check
94+
pass_filenames: false

‎MODULE.bazel‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,30 @@ use_repo(
120120
"vendor_py__tree-sitter-graph-0.12.0",
121121
)
122122

123+
# deps for C/C++ build mode none extractor
124+
# keep in sync by running `misc/bazel/3rdparty/update_cpp_bmn_deps.sh`
125+
cpp_bmn_deps = use_extension("//misc/bazel/3rdparty:cpp_bmn_deps_extension.bzl", "b")
126+
use_repo(
127+
cpp_bmn_deps,
128+
"vendor_cpp_bmn",
129+
"vendor_cpp_bmn__all_asserts-2.3.3",
130+
"vendor_cpp_bmn__anyhow-1.0.98",
131+
"vendor_cpp_bmn__cached-0.54.0",
132+
"vendor_cpp_bmn__chrono-0.4.41",
133+
"vendor_cpp_bmn__itertools-0.14.0",
134+
"vendor_cpp_bmn__num_cpus-1.17.0",
135+
"vendor_cpp_bmn__os_str_bytes-7.1.1",
136+
"vendor_cpp_bmn__rayon-1.11.0",
137+
"vendor_cpp_bmn__regex-1.11.1",
138+
"vendor_cpp_bmn__serde-1.0.219",
139+
"vendor_cpp_bmn__serde_json-1.0.140",
140+
"vendor_cpp_bmn__serde_with-1.14.0",
141+
"vendor_cpp_bmn__tempfile-3.20.0",
142+
"vendor_cpp_bmn__walkdir-2.5.0",
143+
"vendor_cpp_bmn__which-8.0.0",
144+
"vendor_cpp_bmn__zip-6.0.0",
145+
)
146+
123147
# deps for ruby+rust
124148
# keep in sync by running `misc/bazel/3rdparty/update_cargo_deps.sh`
125149
tree_sitter_extractors_deps = use_extension("//misc/bazel/3rdparty:tree_sitter_extractors_extension.bzl", "r")

‎cpp/extractor/bmn/.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+

‎cpp/extractor/bmn/BUILD.bazel‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
load("@rules_rust//rust:defs.bzl", "rust_test")
2+
load("//misc/bazel:rust.bzl", "codeql_rust_binary")
3+
load("//misc/bazel/3rdparty/cpp_bmn_deps:defs.bzl", "all_crate_deps")
4+
5+
exports_files([
6+
"Cargo.lock",
7+
"Cargo.toml",
8+
])
9+
10+
codeql_rust_binary(
11+
name = "bmn",
12+
srcs = glob(["src/**/*.rs"]),
13+
proc_macro_deps = all_crate_deps(proc_macro = True),
14+
visibility = ["//visibility:public"],
15+
deps = all_crate_deps(normal = True),
16+
)
17+
18+
rust_test(
19+
name = "unit_tests",
20+
crate = ":single_arch/bmn",
21+
data = glob([
22+
"tests/resources/**",
23+
"Cargo.toml",
24+
]),
25+
env = {
26+
"BMN_TEST_MANIFEST": "$(rlocationpath :Cargo.toml)",
27+
},
28+
)
29+
30+
test_suite(
31+
name = "tests",
32+
tests = [":unit_tests"],
33+
)

0 commit comments

Comments
 (0)