xref: /aosp_15_r20/external/bazel-skylib/tests/common_settings/BUILD (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1*bcb5dc79SHONG Yifanload("//rules:common_settings.bzl", "int_flag", "string_flag")
2*bcb5dc79SHONG Yifan
3*bcb5dc79SHONG Yifanpackage(
4*bcb5dc79SHONG Yifan    default_applicable_licenses = ["//:license"],
5*bcb5dc79SHONG Yifan    default_testonly = 1,
6*bcb5dc79SHONG Yifan)
7*bcb5dc79SHONG Yifan
8*bcb5dc79SHONG Yifanlicenses(["notice"])
9*bcb5dc79SHONG Yifan
10*bcb5dc79SHONG Yifanint_flag(
11*bcb5dc79SHONG Yifan    name = "my_int_flag",
12*bcb5dc79SHONG Yifan    build_setting_default = 42,
13*bcb5dc79SHONG Yifan    make_variable = "MY_INT_FLAG",
14*bcb5dc79SHONG Yifan)
15*bcb5dc79SHONG Yifan
16*bcb5dc79SHONG Yifanstring_flag(
17*bcb5dc79SHONG Yifan    name = "my_string_flag",
18*bcb5dc79SHONG Yifan    build_setting_default = "foo",
19*bcb5dc79SHONG Yifan    make_variable = "MY_STRING_FLAG",
20*bcb5dc79SHONG Yifan)
21*bcb5dc79SHONG Yifan
22*bcb5dc79SHONG Yifansh_test(
23*bcb5dc79SHONG Yifan    name = "make_variable_test",
24*bcb5dc79SHONG Yifan    srcs = ["make_variable_test.sh"],
25*bcb5dc79SHONG Yifan    env = {
26*bcb5dc79SHONG Yifan        "MESSAGE": "Hello, $(MY_STRING_FLAG)! My name is $(MY_INT_FLAG).",
27*bcb5dc79SHONG Yifan    },
28*bcb5dc79SHONG Yifan    toolchains = [
29*bcb5dc79SHONG Yifan        ":my_int_flag",
30*bcb5dc79SHONG Yifan        ":my_string_flag",
31*bcb5dc79SHONG Yifan    ],
32*bcb5dc79SHONG Yifan)
33