Skip to content

Commit f1021fe

Browse files
authored
cleanup: prefer @platforms rather than @bazel_tools (#8207)
The former is the preferred way to specify platforms. Note that in the testing_util case, I dropped the support for freebsd and openbsd. I'm not sure why those cases were there or if we need them. We don't seem to have those cases elsewhere. I can add them back if they are needed.
1 parent d752a70 commit f1021fe

6 files changed

Lines changed: 17 additions & 28 deletions

File tree

google/cloud/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ load(
5555
name = test.replace("/", "_").replace(".cc", ""),
5656
srcs = [test],
5757
linkopts = select({
58-
"@bazel_tools//src/conditions:windows": [],
58+
"@platforms//os:windows": [],
5959
"//conditions:default": ["-lpthread"],
6060
}),
6161
deps = [
@@ -165,7 +165,7 @@ cc_library(
165165
srcs = google_cloud_cpp_rest_internal_srcs,
166166
hdrs = google_cloud_cpp_rest_internal_hdrs,
167167
copts = select({
168-
"@bazel_tools//src/conditions:windows": [
168+
"@platforms//os:windows": [
169169
"/DWIN32_LEAN_AND_MEAN",
170170
],
171171
"//conditions:default": [],

google/cloud/bigtable/benchmarks/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ load(":bigtable_benchmark_programs.bzl", "bigtable_benchmark_programs")
3636
name = test.replace("/", "_").replace(".cc", ""),
3737
srcs = [test],
3838
linkopts = select({
39-
"@bazel_tools//src/conditions:windows": [],
39+
"@platforms//os:windows": [],
4040
"//conditions:default": ["-lpthread"],
4141
}),
4242
tags = [
@@ -55,7 +55,7 @@ load(":bigtable_benchmarks_unit_tests.bzl", "bigtable_benchmarks_unit_tests")
5555
name = test.replace("/", "_").replace(".cc", ""),
5656
srcs = [test],
5757
linkopts = select({
58-
"@bazel_tools//src/conditions:windows": [],
58+
"@platforms//os:windows": [],
5959
"//conditions:default": ["-lpthread"],
6060
}),
6161
deps = [

google/cloud/storage/BUILD.bazel

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ cc_library(
3131
srcs = google_cloud_cpp_storage_grpc_srcs,
3232
hdrs = google_cloud_cpp_storage_grpc_hdrs,
3333
copts = select({
34-
"@bazel_tools//src/conditions:windows": GOOGLE_CLOUD_STORAGE_WIN_COPTS,
34+
"@platforms//os:windows": GOOGLE_CLOUD_STORAGE_WIN_COPTS,
3535
"//conditions:default": [],
3636
}),
3737
defines = ["GOOGLE_CLOUD_CPP_STORAGE_HAVE_GRPC"],
@@ -56,7 +56,7 @@ cc_library(
5656
srcs = google_cloud_cpp_storage_srcs,
5757
hdrs = google_cloud_cpp_storage_hdrs,
5858
copts = select({
59-
"@bazel_tools//src/conditions:windows": GOOGLE_CLOUD_STORAGE_WIN_COPTS,
59+
"@platforms//os:windows": GOOGLE_CLOUD_STORAGE_WIN_COPTS,
6060
"//conditions:default": [],
6161
}),
6262
visibility = [
@@ -94,7 +94,7 @@ cc_library(
9494
srcs = storage_client_testing_srcs,
9595
hdrs = storage_client_testing_hdrs,
9696
copts = select({
97-
"@bazel_tools//src/conditions:windows": GOOGLE_CLOUD_STORAGE_WIN_COPTS,
97+
"@platforms//os:windows": GOOGLE_CLOUD_STORAGE_WIN_COPTS,
9898
"//conditions:default": [],
9999
}),
100100
deps = [
@@ -116,11 +116,11 @@ load(":storage_client_unit_tests.bzl", "storage_client_unit_tests")
116116
name = test.replace("/", "_").replace(".cc", ""),
117117
srcs = [test],
118118
copts = select({
119-
"@bazel_tools//src/conditions:windows": GOOGLE_CLOUD_STORAGE_WIN_COPTS,
119+
"@platforms//os:windows": GOOGLE_CLOUD_STORAGE_WIN_COPTS,
120120
"//conditions:default": [],
121121
}),
122122
linkopts = select({
123-
"@bazel_tools//src/conditions:windows": [],
123+
"@platforms//os:windows": [],
124124
"//conditions:default": ["-lpthread"],
125125
}),
126126
deps = [
@@ -142,11 +142,11 @@ load(":storage_client_grpc_unit_tests.bzl", "storage_client_grpc_unit_tests")
142142
name = test.replace("/", "_").replace(".cc", ""),
143143
srcs = [test],
144144
copts = select({
145-
"@bazel_tools//src/conditions:windows": GOOGLE_CLOUD_STORAGE_WIN_COPTS,
145+
"@platforms//os:windows": GOOGLE_CLOUD_STORAGE_WIN_COPTS,
146146
"//conditions:default": [],
147147
}),
148148
linkopts = select({
149-
"@bazel_tools//src/conditions:windows": [],
149+
"@platforms//os:windows": [],
150150
"//conditions:default": ["-lpthread"],
151151
}),
152152
deps = [

google/cloud/storage/benchmarks/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ load(":storage_benchmark_programs.bzl", "storage_benchmark_programs")
4242
name = test.replace("/", "_").replace(".cc", ""),
4343
srcs = [test],
4444
linkopts = select({
45-
"@bazel_tools//src/conditions:windows": [],
45+
"@platforms//os:windows": [],
4646
"//conditions:default": ["-lpthread"],
4747
}),
4848
tags = [
@@ -67,7 +67,7 @@ load(":storage_benchmarks_unit_tests.bzl", "storage_benchmarks_unit_tests")
6767
name = test.replace("/", "_").replace(".cc", ""),
6868
srcs = [test],
6969
linkopts = select({
70-
"@bazel_tools//src/conditions:windows": [],
70+
"@platforms//os:windows": [],
7171
"//conditions:default": ["-lpthread"],
7272
}),
7373
deps = [

google/cloud/storage/tests/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ cc_proto_library(
3939
timeout = "long",
4040
srcs = [test],
4141
linkopts = select({
42-
"@bazel_tools//src/conditions:windows": [],
42+
"@platforms//os:windows": [],
4343
"//conditions:default": [
4444
"-lpthread",
4545
"-ldl",

google/cloud/testing_util/BUILD.bazel

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package(default_visibility = ["//visibility:public"])
1616

1717
licenses(["notice"]) # Apache 2.0
1818

19-
load("@bazel_skylib//lib:selects.bzl", "selects")
2019
load(":google_cloud_cpp_testing.bzl", "google_cloud_cpp_testing_hdrs", "google_cloud_cpp_testing_srcs")
2120

2221
config_setting(
@@ -44,22 +43,12 @@ cc_library(
4443
name = "google_cloud_cpp_testing",
4544
srcs = google_cloud_cpp_testing_srcs,
4645
hdrs = google_cloud_cpp_testing_hdrs,
47-
defines = selects.with_or({
48-
(
49-
"@bazel_tools//src/conditions:linux_x86_64",
50-
"@bazel_tools//src/conditions:linux_s390x",
51-
"@bazel_tools//src/conditions:linux_ppc64le",
52-
"@bazel_tools//src/conditions:linux_ppc",
53-
"@bazel_tools//src/conditions:linux_aarch64",
54-
): [
46+
defines = select({
47+
"@platforms//os:linux": [
5548
"GOOGLE_CLOUD_CPP_HAVE_GETRUSAGE",
5649
"GOOGLE_CLOUD_CPP_HAVE_RUSAGE_THREAD",
5750
],
58-
(
59-
"@bazel_tools//src/conditions:darwin",
60-
"@bazel_tools//src/conditions:freebsd",
61-
"@bazel_tools//src/conditions:openbsd",
62-
): [
51+
"@platforms//os:macos": [
6352
"GOOGLE_CLOUD_CPP_HAVE_GETRUSAGE",
6453
],
6554
"//conditions:default": [],

0 commit comments

Comments
 (0)