Skip to content

Commit 8e31aba

Browse files
author
Paolo Tranquilli
committed
Rust: fix codegen to allow --force
This passes command line arguments to codegen, allowing in particular `--force` to be passed. Also, a convenience `//rust/codegen:py` is added to only run the python based code generation, which will be faster and enough when `ast-generator` is unchanged.
1 parent 24d98ee commit 8e31aba

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

rust/codegen/BUILD.bazel

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@bazel_skylib//rules:native_binary.bzl", "native_binary")
2+
13
_args = [
24
"//rust/ast-generator",
35
"//rust/ast-generator:manifest",
@@ -15,3 +17,16 @@ sh_binary(
1517
"//misc/bazel:sh_runfiles",
1618
],
1719
)
20+
21+
native_binary(
22+
name = "py",
23+
src = "//misc/codegen",
24+
out = "codegen",
25+
args = [
26+
"--configuration-file=$(location //rust:codegen-conf)",
27+
],
28+
data = [
29+
"//rust:codegen-conf",
30+
],
31+
visibility = ["//rust:__subpackages__"],
32+
)

rust/codegen/codegen.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ set -eu
44

55
source misc/bazel/runfiles.sh 2>/dev/null || source external/ql+/misc/bazel/runfiles.sh
66

7+
78
ast_generator="$(rlocation "$1")"
89
ast_generator_manifest="$(rlocation "$2")"
910
codegen="$(rlocation "$3")"
1011
codegen_conf="$(rlocation "$4")"
12+
shift 4
1113

1214
CARGO_MANIFEST_DIR="$(dirname "$ast_generator_manifest")" "$ast_generator"
13-
"$codegen" --configuration-file="$codegen_conf"
15+
"$codegen" --configuration-file="$codegen_conf" "$@"

0 commit comments

Comments
 (0)