xref: /aosp_15_r20/external/bazelbuild-rules_rust/examples/cargo/BUILD.bazel (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1*d4726bddSHONG Yifanload(
2*d4726bddSHONG Yifan    "@rules_rust//cargo:defs.bzl",
3*d4726bddSHONG Yifan    "cargo_build_script",
4*d4726bddSHONG Yifan)
5*d4726bddSHONG Yifanload("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
6*d4726bddSHONG Yifan
7*d4726bddSHONG Yifancargo_build_script(
8*d4726bddSHONG Yifan    name = "build_script",
9*d4726bddSHONG Yifan    srcs = ["build_script.rs"],
10*d4726bddSHONG Yifan    build_script_env = {"SOME_ENV": "42"},
11*d4726bddSHONG Yifan    crate_features = ["bleh"],
12*d4726bddSHONG Yifan    data = ["test.txt"],
13*d4726bddSHONG Yifan)
14*d4726bddSHONG Yifan
15*d4726bddSHONG Yifanrust_library(
16*d4726bddSHONG Yifan    name = "lib",
17*d4726bddSHONG Yifan    srcs = ["lib.rs"],
18*d4726bddSHONG Yifan    deps = [":build_script"],
19*d4726bddSHONG Yifan)
20*d4726bddSHONG Yifan
21*d4726bddSHONG Yifanrust_test(
22*d4726bddSHONG Yifan    name = "test",
23*d4726bddSHONG Yifan    crate = ":lib",
24*d4726bddSHONG Yifan)
25