aboutsummaryrefslogtreecommitdiff
path: root/tests/rule_based_toolchain/toolchain_config/BUILD
blob: 0068963711693f188e5ac811866a1484d7f73577 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
load("@rules_testing//lib:util.bzl", "util")
load("//cc/toolchains:action_type_config.bzl", "cc_action_type_config")
load("//cc/toolchains:args.bzl", "cc_args")
load("//cc/toolchains:feature.bzl", "cc_feature")
load("//cc/toolchains:feature_set.bzl", "cc_feature_set")
load("//cc/toolchains:tool.bzl", "cc_tool")
load("//cc/toolchains/impl:external_feature.bzl", "cc_external_feature")
load("//cc/toolchains/impl:toolchain_config.bzl", "cc_legacy_file_group", "cc_toolchain_config")
load("//tests/rule_based_toolchain:analysis_test_suite.bzl", "analysis_test_suite")
load(":toolchain_config_test.bzl", "TARGETS", "TESTS")

util.helper_target(
    cc_feature_set,
    name = "all_simple_features",
    all_of = [
        ":simple_feature",
        "simple_feature2",
    ],
)

util.helper_target(
    cc_external_feature,
    name = "builtin_feature",
    feature_name = "builtin_feature",
    overridable = True,
)

util.helper_target(
    cc_args,
    name = "c_compile_args",
    actions = ["//tests/rule_based_toolchain/actions:c_compile"],
    args = ["c_compile_args"],
    data = ["//tests/rule_based_toolchain/testdata:file1"],
)

util.helper_target(
    cc_args,
    name = "cpp_compile_args",
    actions = ["//tests/rule_based_toolchain/actions:cpp_compile"],
    args = ["cpp_compile_args"],
    env = {"CPP_COMPILE": "1"},
)

util.helper_target(
    cc_toolchain_config,
    name = "collects_files_toolchain_config",
    action_type_configs = [":compile_config"],
    args = [":c_compile_args"],
    compiler = "gcc-4.1.1",
    skip_experimental_flag_validation_for_test = True,
    target_cpu = "k8",
    target_libc = "glibc-2.2.2",
    target_system_name = "local",
    toolchain_features = [":compile_feature"],
)

util.helper_target(
    cc_legacy_file_group,
    name = "collects_files_c_compile",
    actions = ["//tests/rule_based_toolchain/actions:c_compile"],
    config = ":collects_files_toolchain_config",
)

util.helper_target(
    cc_legacy_file_group,
    name = "collects_files_cpp_compile",
    actions = ["//tests/rule_based_toolchain/actions:cpp_compile"],
    config = ":collects_files_toolchain_config",
)

util.helper_target(
    cc_args,
    name = "compile_args",
    actions = ["//tests/rule_based_toolchain/actions:all_compile"],
    args = ["compile_args"],
    data = ["//tests/rule_based_toolchain/testdata:file2"],
)

util.helper_target(
    cc_action_type_config,
    name = "compile_config",
    action_types = ["//tests/rule_based_toolchain/actions:all_compile"],
    args = [":cpp_compile_args"],
    tools = [
        "//tests/rule_based_toolchain/tool:wrapped_tool",
    ],
)

util.helper_target(
    cc_feature,
    name = "compile_feature",
    args = [":compile_args"],
    enabled = True,
    feature_name = "compile_feature",
)

util.helper_target(
    cc_action_type_config,
    name = "c_compile_config",
    action_types = ["//tests/rule_based_toolchain/actions:c_compile"],
    implies = [":simple_feature"],
    tools = [
        "//tests/rule_based_toolchain/tool:wrapped_tool",
    ],
)

util.helper_target(
    cc_feature,
    name = "implies_simple_feature",
    args = [":c_compile_args"],
    enabled = True,
    feature_name = "implies",
    implies = [":simple_feature"],
)

util.helper_target(
    cc_feature,
    name = "overrides_feature",
    args = [":c_compile_args"],
    enabled = True,
    overrides = ":builtin_feature",
)

util.helper_target(
    cc_args,
    name = "requires_all_simple_args",
    actions = ["//tests/rule_based_toolchain/actions:c_compile"],
    args = ["--foo"],
    requires_any_of = [":all_simple_features"],
)

util.helper_target(
    cc_feature,
    name = "requires_all_simple_feature",
    args = [":c_compile_args"],
    enabled = True,
    feature_name = "requires_any_simple",
    requires_any_of = [":all_simple_features"],
)

util.helper_target(
    cc_tool,
    name = "requires_all_simple_tool",
    src = "//tests/rule_based_toolchain/testdata:bin_wrapper.sh",
    requires_any_of = [":all_simple_features"],
)

util.helper_target(
    cc_action_type_config,
    name = "requires_all_simple_action_type_config",
    action_types = ["//tests/rule_based_toolchain/actions:c_compile"],
    tools = [":requires_all_simple_tool"],
)

util.helper_target(
    cc_feature,
    name = "requires_any_simple_feature",
    args = [":c_compile_args"],
    enabled = True,
    feature_name = "requires_any_simple",
    requires_any_of = [
        ":simple_feature",
        ":simple_feature2",
    ],
)

util.helper_target(
    cc_feature,
    name = "same_feature_name",
    args = [":c_compile_args"],
    enabled = False,
    feature_name = "simple_feature",
    visibility = ["//tests/rule_based_toolchain:__subpackages__"],
)

util.helper_target(
    cc_feature,
    name = "simple_feature",
    args = [":c_compile_args"],
    enabled = False,
    feature_name = "simple_feature",
)

util.helper_target(
    cc_feature,
    name = "simple_feature2",
    args = [":c_compile_args"],
    enabled = False,
    feature_name = "simple_feature2",
    visibility = ["//tests/rule_based_toolchain:__subpackages__"],
)

analysis_test_suite(
    name = "test_suite",
    targets = TARGETS,
    tests = TESTS,
)