Skip to content

Commit 81828ea

Browse files
committed
chore: additional updates to prepare for v3.0.0 (#14999)
chore: update to protobuf v30 and remove cxx14 build (#15013) * chore: update to protobuf v30 and remove cxx14 build * update grpc to v1.71.0 * use new abseil repo name * add repo_mapping for absl * disable bzlmod for bazel-targets build * combine zypper commands chore: update abseil to 20250127.1 (#15039) chore(ci): update api and abi for v3 (#15041) chore(bazel): get bazel 8 working (#15042) * chore(bazel): get bazel 8 working * enable workspace where we disable bzlmod * patch googleapis BUILD.bazel when using workspace * check for null json * determine generation proto paths dynamically * bazel quickstart version has to be changed in two phases * update quickstart bazelrc to use c++17
1 parent 632ccef commit 81828ea

File tree

210 files changed

+1587
-1607
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+1587
-1607
lines changed

.bazelrc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818
# Use host-OS-specific config lines from bazelrc files.
1919
build --enable_platform_specific_config=true
2020

21-
# The project requires C++ >= 14. By default Bazel adds `-std=c++0x` which
22-
# disables C++14 features, even if the compilers defaults to C++ >= 14
23-
build:linux --cxxopt=-std=c++14
24-
build:macos --cxxopt=-std=c++14
25-
# Protobuf and gRPC require (or soon will require) C++14 to compile the "host"
21+
# The project requires C++ >= 17.
22+
build:linux --cxxopt=-std=c++17
23+
build:macos --cxxopt=-std=c++17
24+
# Protobuf and gRPC require C++17 to compile the "host"
2625
# targets, such as protoc and the grpc plugin.
27-
build:linux --host_cxxopt=-std=c++14
28-
build:macos --host_cxxopt=-std=c++14
26+
build:linux --host_cxxopt=-std=c++17
27+
build:macos --host_cxxopt=-std=c++17
2928

3029
# Do not create the convenience links. They are inconvenient when the build
3130
# runs inside a docker image or if one builds a quickstart and then builds

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.6.1
1+
8.1.1

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Checks: >
8585
performance-*,
8686
portability-*,
8787
readability-*,
88+
-bugprone-exception-escape,
8889
-google-readability-braces-around-statements,
8990
-google-readability-namespace-comments,
9091
-google-runtime-references,

MODULE.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ module(
2222

2323
bazel_dep(name = "platforms", version = "0.0.11")
2424
bazel_dep(name = "bazel_skylib", version = "1.7.1")
25-
bazel_dep(name = "rules_cc", version = "0.0.17")
26-
bazel_dep(name = "abseil-cpp", version = "20240722.1", repo_name = "com_google_absl")
27-
bazel_dep(name = "protobuf", version = "30.0-rc1", repo_name = "com_google_protobuf")
25+
bazel_dep(name = "rules_cc", version = "0.1.1")
26+
bazel_dep(name = "abseil-cpp", version = "20250127.1", repo_name = "abseil-cpp")
27+
bazel_dep(name = "protobuf", version = "30.2", repo_name = "com_google_protobuf")
2828
bazel_dep(name = "boringssl", version = "0.0.0-20230215-5c22014")
29-
bazel_dep(name = "grpc", version = "1.70.1", repo_name = "com_github_grpc_grpc")
3029
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "com_github_nlohmann_json")
3130
bazel_dep(name = "curl", version = "8.8.0.bcr.3", repo_name = "com_github_curl_curl")
3231
bazel_dep(name = "crc32c", version = "1.1.0", repo_name = "com_github_google_crc32c")
@@ -52,6 +51,7 @@ python.toolchain(
5251
python_version = "3.11",
5352
)
5453

54+
bazel_dep(name = "grpc", version = "1.71.0", repo_name = "com_github_grpc_grpc")
5555
bazel_dep(name = "googleapis", version = "0.0.0", repo_name = "com_google_googleapis")
5656
archive_override(
5757
module_name = "googleapis",

bazel/gapic.bzl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ def cc_gapic_library(name, service_dirs = [], googleapis_deps = [], additional_d
3838

3939
native.filegroup(
4040
name = "srcs",
41-
srcs = native.glob(sources_glob),
41+
srcs = native.glob(sources_glob, allow_empty = True),
4242
)
4343

4444
native.filegroup(
4545
name = "hdrs",
46-
srcs = native.glob(include = code_glob, exclude = sources_glob),
46+
srcs = native.glob(include = code_glob, exclude = sources_glob, allow_empty = True),
4747
)
4848

4949
native.filegroup(
5050
name = "public_hdrs",
51-
srcs = native.glob([d + "*.h" for d in service_dirs]),
51+
srcs = native.glob([d + "*.h" for d in service_dirs], allow_empty = True),
5252
visibility = ["//:__pkg__"],
5353
)
5454

5555
native.filegroup(
5656
name = "mocks",
57-
srcs = native.glob([d + "mocks/*.h" for d in service_dirs]),
57+
srcs = native.glob([d + "mocks/*.h" for d in service_dirs], allow_empty = True),
5858
visibility = ["//:__pkg__"],
5959
)
6060

@@ -84,4 +84,4 @@ def cc_gapic_library(name, service_dirs = [], googleapis_deps = [], additional_d
8484
"//:" + name,
8585
"//google/cloud/testing_util:google_cloud_cpp_testing_private",
8686
],
87-
) for sample in native.glob([d + "samples/*_samples.cc" for d in service_dirs])]
87+
) for sample in native.glob([d + "samples/*_samples.cc" for d in service_dirs], allow_empty = True)]

bazel/googleapis.workspace.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/BUILD.bazel b/BUILD.bazel
2+
index 95e4c12e5..83838d3f0 100644
3+
--- a/BUILD.bazel
4+
+++ b/BUILD.bazel
5+
@@ -2,7 +2,7 @@ genrule(
6+
name = "build_gen",
7+
outs = ["build_gen.sh"],
8+
executable = True,
9+
- srcs = glob(["run_build_gen.sh"]),
10+
+ srcs = glob(["run_build_gen.sh"], allow_empty=True),
11+
cmd = """
12+
if test -z \"$(SRCS)\"; then
13+
cat <<EOD > $@

bazel/workspace0.bzl

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,19 @@ def gl_cpp_workspace0(name = None):
7171
http_archive,
7272
name = "rules_cc",
7373
urls = [
74-
"https://github.com/bazelbuild/rules_cc/releases/download/0.0.17/rules_cc-0.0.17.tar.gz",
74+
"https://github.com/bazelbuild/rules_cc/releases/download/0.1.1/rules_cc-0.1.1.tar.gz",
7575
],
76-
sha256 = "abc605dd850f813bb37004b77db20106a19311a96b2da1c92b789da529d28fe1",
77-
strip_prefix = "rules_cc-0.0.17",
76+
sha256 = "712d77868b3152dd618c4d64faaddefcc5965f90f5de6e6dd1d5ddcd0be82d42",
77+
strip_prefix = "rules_cc-0.1.1",
78+
)
79+
80+
maybe(
81+
http_archive,
82+
name = "com_envoyproxy_protoc_gen_validate",
83+
urls = [
84+
"https://github.com/bufbuild/protoc-gen-validate/archive/v1.2.1.tar.gz",
85+
],
86+
strip_prefix = "protoc-gen-validate-1.2.1",
7887
)
7988

8089
# protobuf requires this
@@ -101,7 +110,7 @@ def gl_cpp_workspace0(name = None):
101110
# Load Abseil
102111
maybe(
103112
http_archive,
104-
name = "com_google_absl",
113+
name = "abseil-cpp",
105114
urls = [
106115
"https://github.com/abseil/abseil-cpp/archive/20250127.1.tar.gz",
107116
],
@@ -137,7 +146,7 @@ def gl_cpp_workspace0(name = None):
137146
# protobuf message. No changes to `patches` should ever be
138147
# committed to the main branch.
139148
patch_tool = "patch",
140-
patch_args = ["-p1"],
149+
patch_args = ["-p1", "-l", "-n"],
141150
patches = [],
142151
)
143152

@@ -146,10 +155,10 @@ def gl_cpp_workspace0(name = None):
146155
http_archive,
147156
name = "com_google_protobuf",
148157
urls = [
149-
"https://github.com/protocolbuffers/protobuf/archive/v30.0-rc1.tar.gz",
158+
"https://github.com/protocolbuffers/protobuf/archive/v30.2.tar.gz",
150159
],
151-
sha256 = "e787459d3d5be3bced7b2e1b17e6e83f8a66cb827ca1654e071f3bacb16f8605",
152-
strip_prefix = "protobuf-30.0-rc1",
160+
sha256 = "07a43d88fe5a38e434c7f94129cad56a4c43a51f99336074d0799c2f7d4e44c5",
161+
strip_prefix = "protobuf-30.2",
153162
)
154163

155164
# Load BoringSSL. This could be automatically loaded by gRPC. But as of
@@ -172,10 +181,13 @@ def gl_cpp_workspace0(name = None):
172181
http_archive,
173182
name = "com_github_grpc_grpc",
174183
urls = [
175-
"https://github.com/grpc/grpc/archive/v1.70.1.tar.gz",
184+
"https://github.com/grpc/grpc/archive/v1.71.0.tar.gz",
176185
],
177-
sha256 = "c4e85806a3a23fd2a78a9f8505771ff60b2beef38305167d50f5e8151728e426",
178-
strip_prefix = "grpc-1.70.1",
186+
repo_mapping = {
187+
"@com_google_absl": "@abseil-cpp",
188+
},
189+
sha256 = "0d631419e54ec5b29def798623ee3bf5520dac77abeab3284ef7027ec2363f91",
190+
strip_prefix = "grpc-1.71.0",
179191
)
180192

181193
# We use the cc_proto_library() rule from @com_google_protobuf, which

ci/cloudbuild/builds/bazel-oldest.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,22 @@
1616

1717
set -euo pipefail
1818

19-
export USE_BAZEL_VERSION=6.4.0
19+
export USE_BAZEL_VERSION=7.5.0
2020

2121
source "$(dirname "$0")/../../lib/init.sh"
2222
source module ci/cloudbuild/builds/lib/bazel.sh
2323
source module ci/cloudbuild/builds/lib/cloudcxxrc.sh
24+
source module ci/lib/io.sh
2425

2526
export CC=clang
2627
export CXX=clang++
2728

2829
mapfile -t args < <(bazel::common_args)
2930
args+=(
30-
# For now, we continue to test Bazel 6.x without bzlmod. Once the minimum
31-
# supported version of Bazel is 7.x we can decide how to test without bzlmod.
31+
# Test without bzlmod as WORKSPACE is still supported in bazel 7 LTS.
3232
--noenable_bzlmod
33+
--enable_workspace
3334
# Only run the unit tests, no need to waste time running everything.
3435
--test_tag_filters=-integration-test
3536
)
36-
bazel test "${args[@]}" -- "${BAZEL_TARGETS[@]}"
37+
io::run bazel test "${args[@]}" -- "${BAZEL_TARGETS[@]}"

ci/cloudbuild/builds/check-api.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ fi
4545
# https://github.com/googleapis/google-cloud-cpp/issues/6313
4646
io::run cmake "${cmake_args[@]}" \
4747
-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" \
48+
-DCMAKE_CXX_STANDARD=17 \
4849
-DCMAKE_INSTALL_MESSAGE=NEVER \
4950
-DBUILD_SHARED_LIBS=ON \
5051
-DCMAKE_BUILD_TYPE=Debug \

ci/cloudbuild/builds/clang-7.0.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ ENABLED_FEATURES="${ENABLED_FEATURES},compute"
3232
readonly ENABLED_FEATURES
3333

3434
io::run cmake -GNinja -S . -B cmake-out \
35+
-DCMAKE_CXX_STANDARD=17 \
3536
-DGOOGLE_CLOUD_CPP_ENABLE="${ENABLED_FEATURES}" \
3637
-DGOOGLE_CLOUD_CPP_ENABLE_CCACHE=ON \
3738
-DGOOGLE_CLOUD_CPP_ENABLE_WERROR=ON \

0 commit comments

Comments
 (0)