diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel index 2f4cfb320..80d94362b 100644 --- a/examples/BUILD.bazel +++ b/examples/BUILD.bazel @@ -1,23 +1,5 @@ load("@rules_python//python/pip_install:requirements.bzl", "compile_pip_requirements") -# TODO: This should not be necessary but there appears to be some inconsistent -# behavior with the use of `constraint_value`s in `select` statements. A support -# thread was started at the end of https://github.com/bazelbuild/bazel/pull/12071 -# Once it is possible to replace `:windows` with `@platforms//os:windows` that -# should be done for this file. Note actioning on this will set the minimum -# supported version of Bazel to 4.0.0 for these examples. -config_setting( - name = "windows", - constraint_values = ["@platforms//os:windows"], - visibility = ["//visibility:public"], -) - -config_setting( - name = "macos", - constraint_values = ["@platforms//os:macos"], - visibility = ["//visibility:public"], -) - test_suite( name = "third_party_examples_linux_tests", tags = ["manual"], @@ -32,13 +14,13 @@ test_suite( test_suite( name = "third_party_examples_macos_tests", - tags = ["manual"], + target_compatible_with = ["@platforms//os:macos"], tests = ["@rules_foreign_cc_examples_third_party//:macos_tests"], ) test_suite( name = "third_party_examples_windows_tests", - tags = ["manual"], + target_compatible_with = ["@platforms//os:windows"], tests = ["@rules_foreign_cc_examples_third_party//:windows_tests"], ) diff --git a/examples/cmake_crosstool/static/BUILD.bazel b/examples/cmake_crosstool/static/BUILD.bazel index eff902906..402ae0666 100644 --- a/examples/cmake_crosstool/static/BUILD.bazel +++ b/examples/cmake_crosstool/static/BUILD.bazel @@ -55,7 +55,7 @@ cc_binary( # includes just hello.h, include directory: "include/version123" srcs = ["hello_client.c"], deps = select({ - "//:windows": [":libhello_win"], + "@platforms//os:windows": [":libhello_win"], "//conditions:default": [":libhello"], }), ) @@ -65,7 +65,7 @@ cc_binary( # includes just hello.h, include directory: "include/version123" srcs = ["hello_client.c"], deps = select({ - "//:windows": [":libhello_win_ninja"], + "@platforms//os:windows": [":libhello_win_ninja"], "//conditions:default": [":libhello"], }), ) @@ -75,7 +75,7 @@ cc_binary( # includes just hello.h, include directory: "include/version123" srcs = ["hello_client.c"], deps = select({ - "//:windows": [":libhello_win_nmake"], + "@platforms//os:windows": [":libhello_win_nmake"], "//conditions:default": [":libhello"], }), ) diff --git a/examples/cmake_defines/BUILD.bazel b/examples/cmake_defines/BUILD.bazel index 997898122..6c3f4d3c2 100644 --- a/examples/cmake_defines/BUILD.bazel +++ b/examples/cmake_defines/BUILD.bazel @@ -4,7 +4,7 @@ cmake( name = "lib_a", lib_source = ":lib_a_sources", out_static_libs = select({ - "//:windows": ["lib_a.lib"], + "@platforms//os:windows": ["lib_a.lib"], "//conditions:default": ["liblib_a.a"], }), deps = [":lib_b"], @@ -15,7 +15,7 @@ cmake( defines = ["FOO"], lib_source = ":lib_b_sources", out_static_libs = select({ - "//:windows": ["lib_b.lib"], + "@platforms//os:windows": ["lib_b.lib"], "//conditions:default": ["liblib_b.a"], }), ) diff --git a/examples/cmake_defines/nocrosstool/BUILD.bazel b/examples/cmake_defines/nocrosstool/BUILD.bazel index 43edfac58..2518b067c 100644 --- a/examples/cmake_defines/nocrosstool/BUILD.bazel +++ b/examples/cmake_defines/nocrosstool/BUILD.bazel @@ -5,7 +5,7 @@ cmake( generate_crosstool_file = False, lib_source = "//cmake_defines:lib_a_sources", out_static_libs = select({ - "//:windows": ["lib_a.lib"], + "@platforms//os:windows": ["lib_a.lib"], "//conditions:default": ["liblib_a.a"], }), deps = [":lib_b"], @@ -17,7 +17,7 @@ cmake( generate_crosstool_file = False, lib_source = "//cmake_defines:lib_b_sources", out_static_libs = select({ - "//:windows": ["lib_b.lib"], + "@platforms//os:windows": ["lib_b.lib"], "//conditions:default": ["liblib_b.a"], }), ) diff --git a/examples/cmake_hello_world_lib/binary/BUILD.bazel b/examples/cmake_hello_world_lib/binary/BUILD.bazel index 64770290b..ba0ba4a71 100644 --- a/examples/cmake_hello_world_lib/binary/BUILD.bazel +++ b/examples/cmake_hello_world_lib/binary/BUILD.bazel @@ -18,7 +18,7 @@ cmake( }, lib_source = ":srcs", out_binaries = select({ - "//:windows": ["hello.exe"], + "@platforms//os:windows": ["hello.exe"], "//conditions:default": ["hello"], }), ) @@ -27,7 +27,7 @@ filegroup( name = "binary", srcs = [":libhello"], output_group = select({ - "//:windows": "hello.exe", + "@platforms//os:windows": "hello.exe", "//conditions:default": "hello", }), ) diff --git a/examples/cmake_hello_world_lib/shared/BUILD.bazel b/examples/cmake_hello_world_lib/shared/BUILD.bazel index 2e9ca817d..e0b4d24fa 100644 --- a/examples/cmake_hello_world_lib/shared/BUILD.bazel +++ b/examples/cmake_hello_world_lib/shared/BUILD.bazel @@ -19,12 +19,12 @@ cmake( }, lib_source = ":srcs", out_interface_libs = select({ - "//:windows": ["libhello.lib"], + "@platforms//os:windows": ["libhello.lib"], "//conditions:default": [], }), out_shared_libs = select({ - "//:macos": ["libhello.dylib"], - "//:windows": ["libhello.dll"], + "@platforms//os:macos": ["libhello.dylib"], + "@platforms//os:windows": ["libhello.dll"], "//conditions:default": ["libhello.so"], }), ) diff --git a/examples/cmake_hello_world_lib/static/BUILD.bazel b/examples/cmake_hello_world_lib/static/BUILD.bazel index 8bd4fa10e..0d90bd252 100644 --- a/examples/cmake_hello_world_lib/static/BUILD.bazel +++ b/examples/cmake_hello_world_lib/static/BUILD.bazel @@ -15,7 +15,7 @@ filegroup( cmake( name = "libhello", generate_args = select({ - "//:windows": [ + "@platforms//os:windows": [ "-G \"Visual Studio 15 2017\"", "-A x64", ], @@ -51,7 +51,7 @@ cmake( # pass include/version123 to C/C++ provider as include directory out_include_dir = "include/version123", out_static_libs = select({ - "//:windows": ["libhello.lib"], + "@platforms//os:windows": ["libhello.lib"], "//conditions:default": ["libhello.a"], }), ) @@ -120,7 +120,7 @@ cmake( out_include_dir = "include", # the name of the static library != .a, put it explicitly out_static_libs = select({ - "//:windows": ["libhello.lib"], + "@platforms//os:windows": ["libhello.lib"], "//conditions:default": ["libhello.a"], }), ) diff --git a/examples/cmake_with_bazel_transitive/BUILD.bazel b/examples/cmake_with_bazel_transitive/BUILD.bazel index 8a5bde963..28e62d69a 100644 --- a/examples/cmake_with_bazel_transitive/BUILD.bazel +++ b/examples/cmake_with_bazel_transitive/BUILD.bazel @@ -15,7 +15,7 @@ cmake( generate_args = ["-GNinja"], lib_source = "//cmake_with_bazel_transitive/libb:b_srcs", out_static_libs = select({ - "//:windows": ["libb.lib"], + "@platforms//os:windows": ["libb.lib"], "//conditions:default": ["libb.a"], }), # This library is with public visibility, we can reuse it here. diff --git a/examples/meson_simple/BUILD.bazel b/examples/meson_simple/BUILD.bazel index f274c4bef..04675d33a 100644 --- a/examples/meson_simple/BUILD.bazel +++ b/examples/meson_simple/BUILD.bazel @@ -6,7 +6,7 @@ meson( name = "meson_lib", build_data = ["//meson_simple/code:clang_wrapper.sh"], env = select({ - "//:windows": { + "@platforms//os:windows": { "CLANG_WRAPPER": "$(execpath //meson_simple/code:clang_wrapper.sh)", "CXX_FLAGS": "/MD", }, diff --git a/examples/ninja_simple/BUILD.bazel b/examples/ninja_simple/BUILD.bazel index f6b730a56..411045d42 100644 --- a/examples/ninja_simple/BUILD.bazel +++ b/examples/ninja_simple/BUILD.bazel @@ -5,7 +5,7 @@ ninja( name = "ninja_lib", build_data = ["//ninja_simple/code:clang_wrapper.sh"], env = select({ - "//:windows": { + "@platforms//os:windows": { "CLANG_WRAPPER": "$(execpath //ninja_simple/code:clang_wrapper.sh)", "CXX_FLAGS": "/MD", },