@@ -104,14 +104,14 @@ We can improve on this solution by using `select` to choose the `compiler`
104
104
config_setting(
105
105
name = " on_linux" ,
106
106
constraint_values = [
107
- " @platforms//os :linux" ,
107
+ " @bazel_tools//platforms :linux" ,
108
108
],
109
109
)
110
110
111
111
config_setting(
112
112
name = " on_windows" ,
113
113
constraint_values = [
114
- " @platforms//os :windows" ,
114
+ " @bazel_tools//platforms :windows" ,
115
115
],
116
116
)
117
117
@@ -276,12 +276,12 @@ appropriate for a given platform.
276
276
toolchain(
277
277
name = " barc_linux_toolchain" ,
278
278
exec_compatible_with = [
279
- " @platforms//os :linux" ,
280
- " @platforms//cpu :x86_64" ,
279
+ " @bazel_tools//platforms :linux" ,
280
+ " @bazel_tools//platforms :x86_64" ,
281
281
],
282
282
target_compatible_with = [
283
- " @platforms//os :linux" ,
284
- " @platforms//cpu :x86_64" ,
283
+ " @bazel_tools//platforms :linux" ,
284
+ " @bazel_tools//platforms :x86_64" ,
285
285
],
286
286
toolchain = " :barc_linux" ,
287
287
toolchain_type = " :toolchain_type" ,
@@ -290,12 +290,12 @@ toolchain(
290
290
toolchain(
291
291
name = " barc_windows_toolchain" ,
292
292
exec_compatible_with = [
293
- " @platforms//os :windows" ,
294
- " @platforms//cpu :x86_64" ,
293
+ " @bazel_tools//platforms :windows" ,
294
+ " @bazel_tools//platforms :x86_64" ,
295
295
],
296
296
target_compatible_with = [
297
- " @platforms//os :windows" ,
298
- " @platforms//cpu :x86_64" ,
297
+ " @bazel_tools//platforms :windows" ,
298
+ " @bazel_tools//platforms :x86_64" ,
299
299
],
300
300
toolchain = " :barc_windows" ,
301
301
toolchain_type = " :toolchain_type" ,
@@ -336,7 +336,7 @@ toolchain will be selected based on the target and execution platforms.
336
336
platform(
337
337
name = " my_target_platform" ,
338
338
constraint_values = [
339
- " @platforms//os :linux" ,
339
+ " @bazel_tools//platforms :linux" ,
340
340
],
341
341
)
342
342
@@ -351,7 +351,7 @@ bazel build //my_pkg:my_bar_binary --platforms=//my_pkg:my_target_platform
351
351
```
352
352
353
353
Bazel will see that ` //my_pkg:my_bar_binary ` is being built with a platform that
354
- has ` @platforms//os :linux ` and therefore resolve the
354
+ has ` @bazel_tools//platforms :linux ` and therefore resolve the
355
355
` //bar_tools:toolchain_type ` reference to ` //bar_tools:barc_linux_toolchain ` .
356
356
This will end up building ` //bar_tools:barc_linux ` but not
357
357
` //barc_tools:barc_windows ` .
0 commit comments