Skip to content

Commit c1fd4be

Browse files
committed
C++: Add BMN Rust dependency generator
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.
1 parent 08ff51d commit c1fd4be

5 files changed

Lines changed: 30 additions & 1 deletion

File tree

‎cpp/extractor/bmn/BUILD.bazel‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
exports_files([
2+
"Cargo.lock",
3+
"Cargo.toml",
4+
])

‎cpp/extractor/bmn/Cargo.toml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
[workspace]
2+
13
[package]
24
name = "bmn"
35
version = "0.1.0"
46
edition = "2024"
57

68
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
79

8-
# when updating, run `./update_cargo_deps.sh` to update bazel bindings
10+
# When updating, run `misc/bazel/3rdparty/update_cpp_bmn_deps.sh` to update Bazel bindings.
911
[dependencies]
1012
anyhow = "1"
1113
cached = "0.54"

‎misc/bazel/3rdparty/BUILD.bazel‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,14 @@ crates_vendor(
2222
tags = ["manual"],
2323
vendor_path = "py_deps",
2424
)
25+
26+
crates_vendor(
27+
name = "vendor_cpp_bmn_deps",
28+
cargo_lockfile = "//cpp/extractor/bmn:Cargo.lock",
29+
generate_build_scripts = True,
30+
manifests = ["//cpp/extractor/bmn:Cargo.toml"],
31+
mode = "remote",
32+
repository_name = "vendor_cpp_bmn",
33+
tags = ["manual"],
34+
vendor_path = "cpp_bmn_deps",
35+
)

‎misc/bazel/3rdparty/update_cargo_deps.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
77

88
"$SCRIPT_DIR/update_py_deps.sh"
99
"$SCRIPT_DIR/update_tree_sitter_extractors_deps.sh"
10+
"$SCRIPT_DIR/update_cpp_bmn_deps.sh"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#! /usr/bin/env bash
2+
3+
set -eu
4+
5+
WORKSPACE_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/../../.." &> /dev/null && pwd )
6+
7+
cd "$WORKSPACE_DIR"
8+
time bazel run //misc/bazel/3rdparty:vendor_cpp_bmn_deps
9+
# no idea why this is necessary, see https://github.com/bazelbuild/rules_rust/issues/3255
10+
python3 "$WORKSPACE_DIR/misc/bazel/3rdparty/patch_defs.py" misc/bazel/3rdparty/cpp_bmn_deps/defs.bzl
11+
bazel mod tidy

0 commit comments

Comments
 (0)