mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Rust: integrate rust code generation into //rust/codegen
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
load("@bazel_skylib//rules:native_binary.bzl", "native_binary")
|
||||
_args = [
|
||||
"//rust/ast-generator",
|
||||
"//rust/ast-generator:manifest",
|
||||
"//misc/codegen",
|
||||
"//rust:codegen-conf",
|
||||
]
|
||||
|
||||
native_binary(
|
||||
sh_binary(
|
||||
name = "codegen",
|
||||
src = "//misc/codegen",
|
||||
out = "codegen",
|
||||
args = [
|
||||
"--configuration-file=$(location //rust:codegen-conf)",
|
||||
],
|
||||
data = [
|
||||
"//rust:codegen-conf",
|
||||
"//rust:schema",
|
||||
],
|
||||
srcs = ["codegen.sh"],
|
||||
args = ["$(rlocationpath %s)" % a for a in _args],
|
||||
data = _args,
|
||||
visibility = ["//rust:__subpackages__"],
|
||||
deps = [
|
||||
"//misc/bazel:sh_runfiles",
|
||||
],
|
||||
)
|
||||
|
||||
13
rust/codegen/codegen.sh
Executable file
13
rust/codegen/codegen.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
source misc/bazel/runfiles.sh 2>/dev/null || source external/ql~/misc/bazel/runfiles.sh
|
||||
|
||||
ast_generator="$(rlocation "$1")"
|
||||
ast_generator_manifest="$(rlocation "$2")"
|
||||
codegen="$(rlocation "$3")"
|
||||
codegen_conf="$(rlocation "$4")"
|
||||
|
||||
CARGO_MANIFEST_DIR="$(dirname "$ast_generator_manifest")" "$ast_generator"
|
||||
"$codegen" --configuration-file="$codegen_conf"
|
||||
Reference in New Issue
Block a user