@@ -9,6 +9,13 @@ ENABLE_PIPELINING = {
9
9
str (Label ("//rust/settings:pipelined_compilation" )): True ,
10
10
}
11
11
12
+ # TODO: Fix pipeline compilation on windows
13
+ # https://github.com/bazelbuild/rules_rust/issues/3383
14
+ _NO_WINDOWS = select ({
15
+ "@platforms//os:windows" : ["@platforms//:incompatible" ],
16
+ "//conditions:default" : [],
17
+ })
18
+
12
19
def _second_lib_test_impl (ctx ):
13
20
env = analysistest .begin (ctx )
14
21
tut = analysistest .target_under_test (env )
@@ -103,8 +110,21 @@ def _pipelined_compilation_test():
103
110
deps = [":second" ],
104
111
)
105
112
106
- second_lib_test (name = "second_lib_test" , target_under_test = ":second" )
107
- bin_test (name = "bin_test" , target_under_test = ":bin" )
113
+ second_lib_test (
114
+ name = "second_lib_test" ,
115
+ target_under_test = ":second" ,
116
+ target_compatible_with = _NO_WINDOWS ,
117
+ )
118
+ bin_test (
119
+ name = "bin_test" ,
120
+ target_under_test = ":bin" ,
121
+ target_compatible_with = _NO_WINDOWS ,
122
+ )
123
+
124
+ return [
125
+ ":second_lib_test" ,
126
+ ":bin_test" ,
127
+ ]
108
128
109
129
def _rmeta_is_propagated_through_custom_rule_test_impl (ctx ):
110
130
env = analysistest .begin (ctx )
@@ -192,6 +212,10 @@ def _disable_pipelining_test():
192
212
target_under_test = ":lib" ,
193
213
)
194
214
215
+ return [
216
+ ":rmeta_not_produced_if_pipelining_disabled_test" ,
217
+ ]
218
+
195
219
def _custom_rule_test (generate_metadata , suffix ):
196
220
rust_library (
197
221
name = "to_wrap" + suffix ,
@@ -216,33 +240,33 @@ def _custom_rule_test(generate_metadata, suffix):
216
240
name = "rmeta_is_propagated_through_custom_rule_test" + suffix ,
217
241
generate_metadata = generate_metadata ,
218
242
target_under_test = ":uses_wrapper" + suffix ,
243
+ target_compatible_with = _NO_WINDOWS ,
219
244
)
220
245
221
246
rmeta_is_used_when_building_custom_rule_test (
222
247
name = "rmeta_is_used_when_building_custom_rule_test" + suffix ,
223
248
target_under_test = ":wrapper" + suffix ,
249
+ target_compatible_with = _NO_WINDOWS ,
224
250
)
225
251
252
+ return [
253
+ ":rmeta_is_propagated_through_custom_rule_test" + suffix ,
254
+ ":rmeta_is_used_when_building_custom_rule_test" + suffix ,
255
+ ]
256
+
226
257
def pipelined_compilation_test_suite (name ):
227
258
"""Entry-point macro called from the BUILD file.
228
259
229
260
Args:
230
261
name: Name of the macro.
231
262
"""
232
- _pipelined_compilation_test ()
233
- _disable_pipelining_test ()
234
- _custom_rule_test (generate_metadata = True , suffix = "_with_metadata" )
235
- _custom_rule_test (generate_metadata = False , suffix = "_without_metadata" )
263
+ tests = []
264
+ tests .extend (_pipelined_compilation_test ())
265
+ tests .extend (_disable_pipelining_test ())
266
+ tests .extend (_custom_rule_test (generate_metadata = True , suffix = "_with_metadata" ))
267
+ tests .extend (_custom_rule_test (generate_metadata = False , suffix = "_without_metadata" ))
236
268
237
269
native .test_suite (
238
270
name = name ,
239
- tests = [
240
- ":bin_test" ,
241
- ":second_lib_test" ,
242
- ":rmeta_is_propagated_through_custom_rule_test_with_metadata" ,
243
- ":rmeta_is_propagated_through_custom_rule_test_without_metadata" ,
244
- ":rmeta_is_used_when_building_custom_rule_test_with_metadata" ,
245
- ":rmeta_is_used_when_building_custom_rule_test_without_metadata" ,
246
- ":rmeta_not_produced_if_pipelining_disabled_test" ,
247
- ],
271
+ tests = tests ,
248
272
)
0 commit comments