diff --git a/rust/codegen/BUILD.bazel b/rust/codegen/BUILD.bazel index 43e057a6fbf6..ba9f2565b70e 100644 --- a/rust/codegen/BUILD.bazel +++ b/rust/codegen/BUILD.bazel @@ -1,3 +1,5 @@ +load("@bazel_skylib//rules:native_binary.bzl", "native_binary") + _args = [ "//rust/ast-generator", "//rust/ast-generator:manifest", @@ -15,3 +17,16 @@ sh_binary( "//misc/bazel:sh_runfiles", ], ) + +native_binary( + name = "py", + src = "//misc/codegen", + out = "codegen", + args = [ + "--configuration-file=$(location //rust:codegen-conf)", + ], + data = [ + "//rust:codegen-conf", + ], + visibility = ["//rust:__subpackages__"], +) diff --git a/rust/codegen/codegen.sh b/rust/codegen/codegen.sh index cb15c796fd6a..0d746eeb289a 100755 --- a/rust/codegen/codegen.sh +++ b/rust/codegen/codegen.sh @@ -8,6 +8,7 @@ ast_generator="$(rlocation "$1")" ast_generator_manifest="$(rlocation "$2")" codegen="$(rlocation "$3")" codegen_conf="$(rlocation "$4")" +shift 4 CARGO_MANIFEST_DIR="$(dirname "$ast_generator_manifest")" "$ast_generator" -"$codegen" --configuration-file="$codegen_conf" +"$codegen" --configuration-file="$codegen_conf" "$@"