aboutsummaryrefslogtreecommitdiff
path: root/test/build_env/BUILD.bazel
blob: 43de1ffdb0fb100bd3735504de59c4e44be7d172 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
load(
    "//cargo:defs.bzl",
    "cargo_build_script",
)
load("//rust:defs.bzl", "rust_library", "rust_test")

package(default_visibility = ["//visibility:public"])

rust_test(
    name = "conflicting_deps_test",
    srcs = ["tests/manifest_dir.rs"],
    data = ["src/manifest_dir_file.txt"],
    edition = "2018",
)

rust_library(
    name = "arbitrary_env_lib",
    srcs = ["tests/arbitrary_env_lib.rs"],
    edition = "2018",
    rustc_env = {
        "USER_DEFINED_KEY": "USER_DEFINED_VALUE",
    },
)

rust_test(
    name = "arbitrary_env_lib_test",
    crate = ":arbitrary_env_lib",
    edition = "2018",
)

rust_library(
    name = "arbitrary_env_lib_in_test",
    srcs = ["tests/arbitrary_env_lib.rs"],
    edition = "2018",
    rustc_env = {
        "USER_DEFINED_KEY": "DIFFERENT_USER_DEFINED_VALUE",
    },
)

rust_test(
    name = "arbitrary_env_lib_test_in_test",
    crate = ":arbitrary_env_lib_in_test",
    edition = "2018",
    rustc_env = {
        "USER_DEFINED_KEY": "USER_DEFINED_VALUE",
    },
)

rust_test(
    name = "arbitrary_env_test",
    srcs = ["tests/arbitrary_env.rs"],
    edition = "2018",
    rustc_env = {
        "USER_DEFINED_KEY": "USER_DEFINED_VALUE",
    },
)

rust_test(
    # Intentionally uses a mix of -s and _s because those normalisations are part of what is being tested.
    name = "cargo_env-vars_test",
    srcs = ["tests/cargo.rs"],
    edition = "2018",
    deps = [":cargo_build_script_env-vars_build_script"],
)

rust_test(
    name = "cargo-env-vars-custom-crate-name-test",
    srcs = ["tests/custom_crate_name.rs"],
    crate_name = "custom_crate_name",
    edition = "2018",
    deps = [":cargo_build_script_env-vars_build_script"],
)

cargo_build_script(
    name = "cargo_build_script_env-vars_build_script",
    srcs = ["src/build.rs"],
    edition = "2018",
)