mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Rust: add local copy of rust.ungrammar
This copy is injected by the existing `//rust/ast-generator:inject-sources` target, and is useful for development.
This commit is contained in:
1
rust/ast-generator/.gitignore
vendored
1
rust/ast-generator/.gitignore
vendored
@@ -2,3 +2,4 @@
|
|||||||
/.idea
|
/.idea
|
||||||
/src/codegen/grammar.rs
|
/src/codegen/grammar.rs
|
||||||
/src/codegen/grammar/
|
/src/codegen/grammar/
|
||||||
|
/rust.ungram
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ load("//misc/bazel/3rdparty/tree_sitter_extractors_deps:defs.bzl", "aliases", "a
|
|||||||
ra_ap_syntax_workspace, _, _ = str(ra_ap_syntax_label).partition("//")
|
ra_ap_syntax_workspace, _, _ = str(ra_ap_syntax_label).partition("//")
|
||||||
|
|
||||||
alias(
|
alias(
|
||||||
name = "ungram",
|
name = "rust.ungram",
|
||||||
actual = "%s//:rust.ungram" % ra_ap_syntax_workspace,
|
actual = "%s//:rust.ungram" % ra_ap_syntax_workspace,
|
||||||
visibility = ["//rust/codegen:__pkg__"],
|
visibility = ["//rust/codegen:__pkg__"],
|
||||||
)
|
)
|
||||||
@@ -45,9 +45,9 @@ codeql_rust_binary(
|
|||||||
exclude = ["src/codegen/**"],
|
exclude = ["src/codegen/**"],
|
||||||
) + [":codegen"],
|
) + [":codegen"],
|
||||||
aliases = aliases(),
|
aliases = aliases(),
|
||||||
args = ["$(rlocationpath :ungram)"],
|
args = ["$(rlocationpath :rust.ungram)"],
|
||||||
compile_data = glob(["src/templates/*.mustache"]),
|
compile_data = glob(["src/templates/*.mustache"]),
|
||||||
data = [":ungram"],
|
data = [":rust.ungram"],
|
||||||
proc_macro_deps = all_crate_deps(
|
proc_macro_deps = all_crate_deps(
|
||||||
proc_macro = True,
|
proc_macro = True,
|
||||||
),
|
),
|
||||||
@@ -69,7 +69,10 @@ write_file(
|
|||||||
# using cat instead of cp to honor default umask
|
# using cat instead of cp to honor default umask
|
||||||
# (also, macOS does not support `cp --no-preserve=mode`)
|
# (also, macOS does not support `cp --no-preserve=mode`)
|
||||||
'cat "$(rlocation "$%s")" > "$DST_DIR/%s"' % item
|
'cat "$(rlocation "$%s")" > "$DST_DIR/%s"' % item
|
||||||
for item in enumerate(_codegen_outs, 2)
|
for item in enumerate(
|
||||||
|
["rust.ungram"] + _codegen_outs,
|
||||||
|
2,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
is_executable = True,
|
is_executable = True,
|
||||||
)
|
)
|
||||||
@@ -77,8 +80,14 @@ write_file(
|
|||||||
sh_binary(
|
sh_binary(
|
||||||
name = "inject-sources",
|
name = "inject-sources",
|
||||||
srcs = [":update"],
|
srcs = [":update"],
|
||||||
args = ["$(rlocationpath Cargo.toml)"] + ["$(rlocationpath %s)" % f for f in _codegen_outs],
|
args = ["$(rlocationpath %s)" % f for f in [
|
||||||
data = ["Cargo.toml"] + _codegen_outs,
|
"Cargo.toml",
|
||||||
|
":rust.ungram",
|
||||||
|
] + _codegen_outs],
|
||||||
|
data = [
|
||||||
|
"Cargo.toml",
|
||||||
|
":rust.ungram",
|
||||||
|
] + _codegen_outs,
|
||||||
deps = ["//misc/bazel:sh_runfiles"],
|
deps = ["//misc/bazel:sh_runfiles"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
|
|||||||
|
|
||||||
_args = [
|
_args = [
|
||||||
"//rust/ast-generator",
|
"//rust/ast-generator",
|
||||||
"//rust/ast-generator:ungram",
|
"//rust/ast-generator:rust.ungram",
|
||||||
"//rust/ast-generator:Cargo.toml",
|
"//rust/ast-generator:Cargo.toml",
|
||||||
"//misc/codegen",
|
"//misc/codegen",
|
||||||
"//rust:codegen-conf",
|
"//rust:codegen-conf",
|
||||||
|
|||||||
Reference in New Issue
Block a user