Skip to content

Commit 4ab9255

Browse files
authored
Merge pull request #17682 from github/redsun82/rust-codegen
Rust: integrate rust code generation into `//rust/codegen`
2 parents 51d189d + 61c3aa6 commit 4ab9255

File tree

17 files changed

+172
-362
lines changed

17 files changed

+172
-362
lines changed

Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ members = [
77
"ruby/extractor",
88
"rust/extractor",
99
"rust/extractor/macros",
10-
"rust/generate-schema",
10+
"rust/ast-generator",
1111
]
1212

1313
[patch.crates-io]

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ r.from_cargo(
6161
"//ruby/extractor:Cargo.toml",
6262
"//rust/extractor:Cargo.toml",
6363
"//rust/extractor/macros:Cargo.toml",
64-
"//rust/generate-schema:Cargo.toml",
64+
"//rust/ast-generator:Cargo.toml",
6565
"//shared/tree-sitter-extractor:Cargo.toml",
6666
],
6767
)
File renamed without changes.

rust/generate-schema/BUILD.bazel renamed to rust/ast-generator/BUILD.bazel

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
load("@tree_sitter_extractors_deps//:defs.bzl", "aliases", "all_crate_deps")
12
load("//misc/bazel:rust.bzl", "codeql_rust_binary")
23

34
codeql_rust_binary(
4-
name = "generate-schema",
5+
name = "ast-generator",
56
srcs = glob(["src/**/*.rs"]),
67
aliases = aliases(),
78
proc_macro_deps = all_crate_deps(
@@ -12,3 +13,9 @@ codeql_rust_binary(
1213
normal = True,
1314
),
1415
)
16+
17+
filegroup(
18+
name = "manifest",
19+
srcs = ["Cargo.toml"],
20+
visibility = ["//rust:__subpackages__"],
21+
)
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "generate-schema"
2+
name = "ast-generator"
33
version = "0.1.0"
44
edition = "2021"
55

@@ -8,4 +8,3 @@ ungrammar = "1.16.1"
88
proc-macro2 = "1.0.33"
99
quote = "1.0.12"
1010
itertools = "0.10.1"
11-
File renamed without changes.

rust/generate-schema/src/codegen.rs renamed to rust/ast-generator/src/codegen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ pub fn ensure_file_contents(
1212
contents: &String,
1313
_check: bool,
1414
) {
15-
std::fs::write(path, contents).expect("Unable to write file");
15+
std::fs::write(path, contents).unwrap_or_else(|_| panic!("Unable to write {}", path.display()));
1616
}

0 commit comments

Comments
 (0)