@@ -9,6 +9,13 @@ ENABLE_PIPELINING = {
99 str (Label ("//rust/settings:pipelined_compilation" )): True ,
1010}
1111
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+
1219def _second_lib_test_impl (ctx ):
1320 env = analysistest .begin (ctx )
1421 tut = analysistest .target_under_test (env )
@@ -103,8 +110,21 @@ def _pipelined_compilation_test():
103110 deps = [":second" ],
104111 )
105112
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+ ]
108128
109129def _rmeta_is_propagated_through_custom_rule_test_impl (ctx ):
110130 env = analysistest .begin (ctx )
@@ -192,6 +212,10 @@ def _disable_pipelining_test():
192212 target_under_test = ":lib" ,
193213 )
194214
215+ return [
216+ ":rmeta_not_produced_if_pipelining_disabled_test" ,
217+ ]
218+
195219def _custom_rule_test (generate_metadata , suffix ):
196220 rust_library (
197221 name = "to_wrap" + suffix ,
@@ -216,33 +240,33 @@ def _custom_rule_test(generate_metadata, suffix):
216240 name = "rmeta_is_propagated_through_custom_rule_test" + suffix ,
217241 generate_metadata = generate_metadata ,
218242 target_under_test = ":uses_wrapper" + suffix ,
243+ target_compatible_with = _NO_WINDOWS ,
219244 )
220245
221246 rmeta_is_used_when_building_custom_rule_test (
222247 name = "rmeta_is_used_when_building_custom_rule_test" + suffix ,
223248 target_under_test = ":wrapper" + suffix ,
249+ target_compatible_with = _NO_WINDOWS ,
224250 )
225251
252+ return [
253+ ":rmeta_is_propagated_through_custom_rule_test" + suffix ,
254+ ":rmeta_is_used_when_building_custom_rule_test" + suffix ,
255+ ]
256+
226257def pipelined_compilation_test_suite (name ):
227258 """Entry-point macro called from the BUILD file.
228259
229260 Args:
230261 name: Name of the macro.
231262 """
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" ))
236268
237269 native .test_suite (
238270 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 ,
248272 )
0 commit comments