xref: /aosp_15_r20/external/bazelbuild-rules_rust/test/proc_macro/data/BUILD.bazel (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1load("//rust:defs.bzl", "rust_library", "rust_proc_macro", "rust_test")
2
3# Data of both :rust_proc_macro and :proc_macro_helper needs to be available at
4# build time (which is run-time of the procedural macros).
5rust_test(
6    name = "proc_macro_data_test",
7    srcs = ["rust_test.rs"],
8    edition = "2021",
9    proc_macro_deps = [
10        ":rust_proc_macro",
11    ],
12    deps = [
13        ":nonmacro_library",
14    ],
15)
16
17# Data of both :rust_proc_macro and :proc_macro_helper needs to be available.
18rust_library(
19    name = "nonmacro_library",
20    srcs = ["nonmacro_library.rs"],
21    edition = "2021",
22    proc_macro_deps = [
23        ":rust_proc_macro",
24    ],
25)
26
27# No data needs to be available during this build.
28rust_proc_macro(
29    name = "rust_proc_macro",
30    srcs = ["rust_proc_macro.rs"],
31    data = ["proc_macro_data.txt"],
32    edition = "2021",
33    rustc_env = {"CARGO_MANIFEST_DIR": package_name()},
34    deps = [
35        ":proc_macro_helper",
36    ],
37)
38
39rust_library(
40    name = "proc_macro_helper",
41    srcs = ["proc_macro_helper.rs"],
42    data = ["helper_data.txt"],
43    edition = "2021",
44    rustc_env = {"CARGO_MANIFEST_DIR": package_name()},
45)
46