xref: /aosp_15_r20/external/bazelbuild-rules_rust/test/build_env/BUILD.bazel (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1*d4726bddSHONG Yifanload(
2*d4726bddSHONG Yifan    "//cargo:defs.bzl",
3*d4726bddSHONG Yifan    "cargo_build_script",
4*d4726bddSHONG Yifan)
5*d4726bddSHONG Yifanload("//rust:defs.bzl", "rust_library", "rust_test")
6*d4726bddSHONG Yifan
7*d4726bddSHONG Yifanpackage(default_visibility = ["//visibility:public"])
8*d4726bddSHONG Yifan
9*d4726bddSHONG Yifanrust_test(
10*d4726bddSHONG Yifan    name = "conflicting_deps_test",
11*d4726bddSHONG Yifan    srcs = ["tests/manifest_dir.rs"],
12*d4726bddSHONG Yifan    data = ["src/manifest_dir_file.txt"],
13*d4726bddSHONG Yifan    edition = "2018",
14*d4726bddSHONG Yifan)
15*d4726bddSHONG Yifan
16*d4726bddSHONG Yifanrust_library(
17*d4726bddSHONG Yifan    name = "arbitrary_env_lib",
18*d4726bddSHONG Yifan    srcs = ["tests/arbitrary_env_lib.rs"],
19*d4726bddSHONG Yifan    edition = "2018",
20*d4726bddSHONG Yifan    rustc_env = {
21*d4726bddSHONG Yifan        "USER_DEFINED_KEY": "USER_DEFINED_VALUE",
22*d4726bddSHONG Yifan    },
23*d4726bddSHONG Yifan)
24*d4726bddSHONG Yifan
25*d4726bddSHONG Yifanrust_test(
26*d4726bddSHONG Yifan    name = "arbitrary_env_lib_test",
27*d4726bddSHONG Yifan    crate = ":arbitrary_env_lib",
28*d4726bddSHONG Yifan    edition = "2018",
29*d4726bddSHONG Yifan)
30*d4726bddSHONG Yifan
31*d4726bddSHONG Yifanrust_library(
32*d4726bddSHONG Yifan    name = "arbitrary_env_lib_in_test",
33*d4726bddSHONG Yifan    srcs = ["tests/arbitrary_env_lib.rs"],
34*d4726bddSHONG Yifan    edition = "2018",
35*d4726bddSHONG Yifan    rustc_env = {
36*d4726bddSHONG Yifan        "USER_DEFINED_KEY": "DIFFERENT_USER_DEFINED_VALUE",
37*d4726bddSHONG Yifan    },
38*d4726bddSHONG Yifan)
39*d4726bddSHONG Yifan
40*d4726bddSHONG Yifanrust_test(
41*d4726bddSHONG Yifan    name = "arbitrary_env_lib_test_in_test",
42*d4726bddSHONG Yifan    crate = ":arbitrary_env_lib_in_test",
43*d4726bddSHONG Yifan    edition = "2018",
44*d4726bddSHONG Yifan    rustc_env = {
45*d4726bddSHONG Yifan        "USER_DEFINED_KEY": "USER_DEFINED_VALUE",
46*d4726bddSHONG Yifan    },
47*d4726bddSHONG Yifan)
48*d4726bddSHONG Yifan
49*d4726bddSHONG Yifanrust_test(
50*d4726bddSHONG Yifan    name = "arbitrary_env_test",
51*d4726bddSHONG Yifan    srcs = ["tests/arbitrary_env.rs"],
52*d4726bddSHONG Yifan    edition = "2018",
53*d4726bddSHONG Yifan    rustc_env = {
54*d4726bddSHONG Yifan        "USER_DEFINED_KEY": "USER_DEFINED_VALUE",
55*d4726bddSHONG Yifan    },
56*d4726bddSHONG Yifan)
57*d4726bddSHONG Yifan
58*d4726bddSHONG Yifanrust_test(
59*d4726bddSHONG Yifan    # Intentionally uses a mix of -s and _s because those normalisations are part of what is being tested.
60*d4726bddSHONG Yifan    name = "cargo_env-vars_test",
61*d4726bddSHONG Yifan    srcs = ["tests/cargo.rs"],
62*d4726bddSHONG Yifan    edition = "2018",
63*d4726bddSHONG Yifan    deps = [":cargo_build_script_env-vars_bs"],
64*d4726bddSHONG Yifan)
65*d4726bddSHONG Yifan
66*d4726bddSHONG Yifanrust_test(
67*d4726bddSHONG Yifan    name = "cargo-env-vars-custom-crate-name-test",
68*d4726bddSHONG Yifan    srcs = ["tests/custom_crate_name.rs"],
69*d4726bddSHONG Yifan    crate_name = "custom_crate_name",
70*d4726bddSHONG Yifan    edition = "2018",
71*d4726bddSHONG Yifan    deps = [":cargo_build_script_env-vars_bs"],
72*d4726bddSHONG Yifan)
73*d4726bddSHONG Yifan
74*d4726bddSHONG Yifancargo_build_script(
75*d4726bddSHONG Yifan    name = "cargo_build_script_env-vars_bs",
76*d4726bddSHONG Yifan    srcs = ["src/build.rs"],
77*d4726bddSHONG Yifan    edition = "2018",
78*d4726bddSHONG Yifan)
79