[bazel][NFC] Replace @bazel_tools//src/conditions with equivalent @platforms rules
Followup to D147354. Using src/conditions is discouraged in favor of using rules from the `@platforms` repository directly. This replaces three conditions: * `@bazel_tools//src/conditions:windows` -> `@platforms//os:windows` * `@bazel_tools//src/conditions:darwin` -> `@platforms//os:macos` * `@bazel_tools//src/conditions:freebsd` -> `@platforms//os:freebsd` `llvm/config.bzl` has a non-trivial OS+CPU selection config, so that is omitted from this patch. There is intentionally no equivalent for that in `@platforms` because every project will have their own opinions about what a platform is, and it is not feasible for the bazel selection list to include every possible combination. The recommended idiom there is for projects to define their own supported platforms list, e.g. in a separate BUILD file or platform mapping. Reviewed By: GMNGeoffrey Differential Revision: https://reviews.llvm.org/D147948
This commit is contained in:
parent
6de3afeaef
commit
5e57f1bf52
@ -1378,7 +1378,7 @@ cc_library(
|
||||
"lib/Driver",
|
||||
],
|
||||
linkopts = select({
|
||||
"@bazel_tools//src/conditions:windows": ["version.lib"],
|
||||
"@platforms//os:windows": ["version.lib"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
textual_hdrs = glob([
|
||||
@ -1881,7 +1881,7 @@ cc_plugin_library(
|
||||
]),
|
||||
hdrs = glob(["include/clang-c/*.h"]),
|
||||
copts = select({
|
||||
"@bazel_tools//src/conditions:windows": ["-D_CINDEX_LIB_"],
|
||||
"@platforms//os:windows": ["-D_CINDEX_LIB_"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
strip_include_prefix = "include",
|
||||
@ -1970,7 +1970,7 @@ cc_binary(
|
||||
testonly = 1,
|
||||
srcs = ["tools/c-arcmt-test/c-arcmt-test.c"],
|
||||
copts = select({
|
||||
"@bazel_tools//src/conditions:windows": [],
|
||||
"@platforms//os:windows": [],
|
||||
"//conditions:default": ["-std=gnu99"],
|
||||
}),
|
||||
stamp = 0,
|
||||
|
@ -531,7 +531,7 @@ cc_test(
|
||||
"libclang/TestUtils.h",
|
||||
],
|
||||
args = select({
|
||||
"@bazel_tools//src/conditions:windows": [
|
||||
"@platforms//os:windows": [
|
||||
# Need to disable the VFS tests that don't use Windows friendly
|
||||
# paths. These are also disabled on Windows in the CMake build.
|
||||
"--gtest_filter=-*VirtualFileOverlay*",
|
||||
|
@ -191,7 +191,7 @@ cc_library(
|
||||
# To avoid a dependency cycle.
|
||||
"include/llvm/Option/*.h",
|
||||
]) + select({
|
||||
"@bazel_tools//src/conditions:windows": glob([
|
||||
"@platforms//os:windows": glob([
|
||||
"lib/Support/Windows/*.h",
|
||||
"lib/Support/Windows/*.inc",
|
||||
]),
|
||||
@ -255,8 +255,8 @@ cc_library(
|
||||
}),
|
||||
includes = ["include"],
|
||||
linkopts = select({
|
||||
"@bazel_tools//src/conditions:windows": [],
|
||||
"@bazel_tools//src/conditions:freebsd": [
|
||||
"@platforms//os:windows": [],
|
||||
"@platforms//os:freebsd": [
|
||||
"-pthread",
|
||||
"-lexecinfo",
|
||||
"-ldl",
|
||||
@ -1124,7 +1124,7 @@ cc_library(
|
||||
"lib/TargetParser/*.cpp",
|
||||
"lib/TargetParser/*.h",
|
||||
]) + select({
|
||||
"@bazel_tools//src/conditions:windows": glob([
|
||||
"@platforms//os:windows": glob([
|
||||
"lib/TargetParser/Windows/*.h",
|
||||
"lib/TargetParser/Windows/*.inc",
|
||||
]),
|
||||
@ -2105,7 +2105,7 @@ gentbl(
|
||||
# MSVC isn't happy with long string literals, while other compilers
|
||||
# which support them get significant compile time improvements with
|
||||
# them enabled. Ideally this flag would only be enabled on Windows via
|
||||
# a select() on `@bazel_tools//src/conditions:windows,`, but that would
|
||||
# a select() on `@platforms//os:windows,`, but that would
|
||||
# require refactoring gentbl from a macro into a rule.
|
||||
# TODO(#92): Refactor gentbl to support this use
|
||||
tblgen_args = "--long-string-literals=0",
|
||||
@ -2581,9 +2581,9 @@ cc_library(
|
||||
copts = llvm_copts,
|
||||
linkopts = select({
|
||||
"@platforms//os:android": [],
|
||||
"@bazel_tools//src/conditions:windows": [],
|
||||
"@bazel_tools//src/conditions:freebsd": [],
|
||||
"@bazel_tools//src/conditions:darwin": [],
|
||||
"@platforms//os:windows": [],
|
||||
"@platforms//os:freebsd": [],
|
||||
"@platforms//os:macos": [],
|
||||
"//conditions:default": [
|
||||
"-lrt",
|
||||
],
|
||||
@ -2647,9 +2647,9 @@ cc_library(
|
||||
copts = llvm_copts,
|
||||
linkopts = select({
|
||||
"@platforms//os:android": [],
|
||||
"@bazel_tools//src/conditions:windows": [],
|
||||
"@bazel_tools//src/conditions:freebsd": [],
|
||||
"@bazel_tools//src/conditions:darwin": [],
|
||||
"@platforms//os:windows": [],
|
||||
"@platforms//os:freebsd": [],
|
||||
"@platforms//os:macos": [],
|
||||
"//conditions:default": [
|
||||
"-lrt",
|
||||
],
|
||||
@ -3012,8 +3012,8 @@ cc_binary(
|
||||
# ll scripts rely on symbols from dependent
|
||||
# libraries being resolvable.
|
||||
linkopts = select({
|
||||
"@bazel_tools//src/conditions:windows": [],
|
||||
"@bazel_tools//src/conditions:darwin": [],
|
||||
"@platforms//os:windows": [],
|
||||
"@platforms//os:macos": [],
|
||||
"//conditions:default": [
|
||||
"-Wl,--undefined=_ZTIi",
|
||||
"-Wl,--export-dynamic-symbol=_ZTIi",
|
||||
@ -3521,8 +3521,8 @@ cc_binary(
|
||||
copts = llvm_copts,
|
||||
# Make symbols from the standard library dynamically resolvable.
|
||||
linkopts = select({
|
||||
"@bazel_tools//src/conditions:windows": [],
|
||||
"@bazel_tools//src/conditions:darwin": [],
|
||||
"@platforms//os:windows": [],
|
||||
"@platforms//os:macos": [],
|
||||
"//conditions:default": [
|
||||
"-Wl,--undefined=_ZTIi",
|
||||
"-Wl,--export-dynamic-symbol=_ZTIi",
|
||||
@ -4471,8 +4471,8 @@ cc_binary(
|
||||
]),
|
||||
copts = llvm_copts,
|
||||
linkopts = select({
|
||||
"@bazel_tools//src/conditions:windows": [],
|
||||
"@bazel_tools//src/conditions:darwin": [],
|
||||
"@platforms//os:windows": [],
|
||||
"@platforms//os:macos": [],
|
||||
"//conditions:default": ["-Wl,--export-dynamic"],
|
||||
}),
|
||||
stamp = 0,
|
||||
@ -4701,8 +4701,8 @@ cc_binary(
|
||||
# isn't even used in the main binary, so we also need to force it
|
||||
# to be included.
|
||||
linkopts = select({
|
||||
"@bazel_tools//src/conditions:windows": [],
|
||||
"@bazel_tools//src/conditions:darwin": [],
|
||||
"@platforms//os:windows": [],
|
||||
"@platforms//os:macos": [],
|
||||
"//conditions:default": [
|
||||
"-rdynamic",
|
||||
"-u_ZTIi",
|
||||
|
@ -43,8 +43,8 @@ def cc_plugin_library(name, srcs, hdrs, include_prefix = None, strip_include_pre
|
||||
native.filegroup(
|
||||
name = interface_output_name,
|
||||
srcs = select({
|
||||
"@bazel_tools//src/conditions:windows": [":" + dll_name],
|
||||
"@bazel_tools//src/conditions:darwin": [":" + dylib_name],
|
||||
"@platforms//os:windows": [":" + dll_name],
|
||||
"@platforms//os:macos": [":" + dylib_name],
|
||||
"//conditions:default": [":" + so_name],
|
||||
}),
|
||||
output_group = "interface_library",
|
||||
@ -53,8 +53,8 @@ def cc_plugin_library(name, srcs, hdrs, include_prefix = None, strip_include_pre
|
||||
name = import_name,
|
||||
interface_library = ":" + interface_output_name,
|
||||
shared_library = select({
|
||||
"@bazel_tools//src/conditions:windows": ":" + dll_name,
|
||||
"@bazel_tools//src/conditions:darwin": ":" + dylib_name,
|
||||
"@platforms//os:windows": ":" + dll_name,
|
||||
"@platforms//os:macos": ":" + dylib_name,
|
||||
"//conditions:default": ":" + so_name,
|
||||
}),
|
||||
alwayslink = alwayslink,
|
||||
|
@ -58,7 +58,7 @@ cc_library(
|
||||
"__STDC_LIMIT_MACROS",
|
||||
"__STDC_CONSTANT_MACROS",
|
||||
] + select({
|
||||
"@bazel_tools//src/conditions:windows": ["GTEST_USE_OWN_TR1_TUPLE=0"],
|
||||
"@platforms//os:windows": ["GTEST_USE_OWN_TR1_TUPLE=0"],
|
||||
"//conditions:default": ["GTEST_USE_OWN_TR1_TUPLE=1"],
|
||||
}),
|
||||
includes = [
|
||||
|
@ -19,7 +19,7 @@ def _impl(repository_ctx):
|
||||
cc_library(
|
||||
name = "sdk",
|
||||
srcs = select({
|
||||
"@bazel_tools//src/conditions:windows": [
|
||||
"@platforms//os:windows": [
|
||||
"vulkan-sdk/Lib/vulkan-1.lib"
|
||||
],
|
||||
"//conditions:default": [
|
||||
|
Loading…
x
Reference in New Issue
Block a user