Skip to content

Commit d90d23f

Browse files
Google APIscopybara-github
authored andcommitted
feat: upgrade protobuf from v25.7 to v31.0
PiperOrigin-RevId: 881595129
1 parent 9807038 commit d90d23f

File tree

167 files changed

+98
-213
lines changed

Some content is hidden

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

167 files changed

+98
-213
lines changed

.bazeliskrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# See https://github.com/bazelbuild/bazelisk
2-
USE_BAZEL_VERSION=6.3.0
2+
USE_BAZEL_VERSION=7.7.1

.bazelrc

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1+
common --noenable_bzlmod
2+
3+
# --- C++ Toolchain & Compilation ---
4+
# Force C++17 for Protobuf 31 / gRPC 1.74 compatibility
5+
build --cxxopt='-std=c++17'
6+
build --host_cxxopt='-std=c++17'
7+
build --action_env=BAZEL_CXXOPTS="-std=c++17"
8+
9+
# --- Java Toolchain & Runtime (JDK 21) ---
10+
build --java_language_version=21
11+
build --java_runtime_version=remotejdk_21
12+
build --javacopt="-Xep:ImpossibleNullComparison:OFF"
13+
14+
# --- Protobuf & gRPC ---
15+
build --proto_toolchain_for_java="@com_google_protobuf//:java_toolchain"
16+
build --define=grpc_no_ares=true
117
# To make proto_library rules to include source info in the descriptor
218
build --protocopt=--include_source_info
319
build --protocopt=--experimental_allow_proto3_optional
4-
# New boringssl requires C++14
5-
build --repo_env=BAZEL_CXXOPTS="-std=c++14"
620

7-
# This is to avoid JVM SIGBUS crashes on highly parallel builds,
8-
# see https://github.com/bazelbuild/bazel/issues/3236 for more details
9-
build --enable_platform_specific_config
10-
build:linux --sandbox_tmpfs_path=/tmp
21+
# --- Test Environment Fixes ---
22+
test --jvmopt="-Djava.security.manager=allow"
23+
test --jvmopt="--add-opens=java.base/java.lang=ALL-UNNAMED"
24+
build --remote_download_toplevel
1125

12-
# Do not create bazel-* symlinks in the workspace directory
13-
build:linux --experimental_convenience_symlinks=ignore
14-
test:linux --experimental_convenience_symlinks=ignore
15-
run:linux --experimental_convenience_symlinks=ignore
26+
# --- Linux Specific Config ---
27+
build:linux --sandbox_tmpfs_path=/tmp
28+
common:linux --experimental_convenience_symlinks=ignore
1629

17-
### Required Typecheck Performance Selection
18-
# passes an argument `--skipLibCheck` to *every* spawn of tsc
19-
# Bazel 6.4 or greater: 'common' means 'any command that supports this flag'
30+
# --- Performance & Analysis ---
31+
# Bazel 6.4+: 'common' applies to all commands that support the flag
2032
common --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
21-
22-
# Between Bazel 6.0 and 6.3, you need all of this, to avoid discarding the analysis cache:
23-
build --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
24-
fetch --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
25-
query --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
26-
### END Required Typecheck Performance Selection

WORKSPACE

Lines changed: 70 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ switched_rules_by_language(
3030
csharp = True,
3131
gapic = True,
3232
go = True,
33+
go_test = True,
3334
grpc = True,
3435
java = True,
3536
nodejs = True,
@@ -38,19 +39,19 @@ switched_rules_by_language(
3839
ruby = True,
3940
)
4041

41-
_bazel_skylib_version = "1.4.0"
42+
_bazel_skylib_version = "1.7.1"
4243

43-
_bazel_skylib_sha256 = "f24ab666394232f834f74d19e2ff142b0af17466ea0c69a3f4c276ee75f6efce"
44+
_bazel_skylib_sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f"
4445

4546
http_archive(
4647
name = "bazel_skylib",
4748
sha256 = _bazel_skylib_sha256,
4849
urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/{0}/bazel-skylib-{0}.tar.gz".format(_bazel_skylib_version)],
4950
)
5051

51-
_bazel_features_version = "1.2.0"
52+
_bazel_features_version = "1.25.0"
5253

53-
_bazel_features_sha256 = "b8789c83c893d7ef3041d3f2795774936b27ff61701a705df52fd41d6ddbf692"
54+
_bazel_features_sha256 = "66f363065d6693a6f958893114d246698188e63456c64350f58000490b8f2d59"
5455

5556
http_archive(
5657
name = "bazel_features",
@@ -62,9 +63,9 @@ http_archive(
6263
# Protobuf depends on very old version of rules_jvm_external.
6364
# Importing older version of rules_jvm_external first (this is one of the things that protobuf_deps() call
6465
# below will do) breaks the Java client library generation process, so importing the proper version explicitly before calling protobuf_deps().
65-
RULES_JVM_EXTERNAL_TAG = "4.5"
66+
RULES_JVM_EXTERNAL_TAG = "5.3"
6667

67-
RULES_JVM_EXTERNAL_SHA = "b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6"
68+
RULES_JVM_EXTERNAL_SHA = "6cc8444b20307113a62b676846c29ff018402fd4c7097fcd6d0a0fd5f2e86429"
6869

6970
http_archive(
7071
name = "rules_jvm_external",
@@ -111,11 +112,11 @@ rules_pkg_dependencies()
111112
# rules_gapic_repositories because both depend on them and we need to manage
112113
# our versions explicitly rather than depend on the version those bring in
113114
# transitively.
114-
_io_bazel_rules_go_version = "0.46.0"
115+
_io_bazel_rules_go_version = "0.49.0"
115116

116117
http_archive(
117118
name = "io_bazel_rules_go",
118-
sha256 = "80a98277ad1311dacd837f9b16db62887702e9f1d1c4c9f796d0121a46c8e184",
119+
sha256 = "d93ef02f1e72c82d8bb3d5169519b36167b33cf68c252525e3b9d3d5dd143de7",
119120
urls = [
120121
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip".format(_io_bazel_rules_go_version),
121122
"https://github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip".format(_io_bazel_rules_go_version),
@@ -150,25 +151,43 @@ http_archive(
150151
# for most of the other languages as well, so they can be considered as the core cross-language
151152
# dependencies.
152153

153-
_grpc_version = "1.60.0"
154+
_absl_version = "20250814.2" # Matches requirements for gRPC 1.74
154155

155-
_grpc_sha256 = "09640607a340ff0d97407ed22fe4adb177e5bb85329821122084359cd57c3dea"
156+
_absl_sha256 = "f9148fb00ec98a2396bdf875c99a78e6a70afa662b107862d92b285d857a8320"
157+
158+
http_archive(
159+
name = "com_google_absl",
160+
sha256 = _absl_sha256,
161+
strip_prefix = "abseil-cpp-%s" % _absl_version,
162+
urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/%s.tar.gz" % _absl_version],
163+
)
164+
165+
_grpc_version = "1.78.1"
166+
167+
_grpc_sha256 = "f9b1d9fe1648024150593efa077ee0f600f9823a21e9d618b4f304e6c09c9902"
156168

157169
http_archive(
158170
name = "com_github_grpc_grpc",
171+
repo_mapping = {
172+
"@abseil-cpp": "@com_google_absl",
173+
},
159174
sha256 = _grpc_sha256,
160175
strip_prefix = "grpc-%s" % _grpc_version,
161176
urls = ["https://github.com/grpc/grpc/archive/v%s.zip" % _grpc_version],
162177
)
163178

164179
# Explicitly declaring Protobuf version, while Protobuf dependency is already
165180
# instantiated in grpc_deps().
166-
_protobuf_version = "25.7"
181+
_protobuf_version = "31.0"
167182

168-
_protobuf_sha256 = "af034f71287cff2f1691649772c61b13696787a06ff616cadf9869611491fabe"
183+
_protobuf_sha256 = "2b695cb1eaef8e173f884235ee6d55f57186e95d89ebb31361ee55cb5fd1b996"
169184

170185
http_archive(
171186
name = "com_google_protobuf",
187+
repo_mapping = {
188+
"@abseil-cpp": "@com_google_absl",
189+
"@protobuf_maven": "@maven",
190+
},
172191
sha256 = _protobuf_sha256,
173192
strip_prefix = "protobuf-%s" % _protobuf_version,
174193
urls = ["https://github.com/protocolbuffers/protobuf/archive/v%s.tar.gz" % _protobuf_version],
@@ -178,11 +197,26 @@ load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
178197

179198
grpc_deps()
180199

200+
# Protobuf 31.0 and later use abseil-cpp name for Abseil.
201+
# We map it to com_google_absl which is the name used by gRPC.
202+
# Defining it before protobuf_deps() ensures that Protobuf won't try to download its own.
203+
181204
load("@com_google_protobuf//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS", "protobuf_deps")
182205

183206
# This is actually already done within grpc_deps but calling this for Bazel convention.
184207
protobuf_deps()
185208

209+
load("@rules_python//python:repositories.bzl", "py_repositories")
210+
211+
py_repositories()
212+
213+
load("@rules_python//python:pip.bzl", "pip_parse")
214+
215+
pip_parse(
216+
name = "protobuf_pip_deps",
217+
requirements_lock = "@com_google_protobuf//:python/requirements.txt",
218+
)
219+
186220
# gRPC enforces a specific version of Go toolchain which conflicts with our build.
187221
# All the relevant parts of grpc_extra_deps() are imported in this WORKSPACE file
188222
# explicitly, that is why we do not call grpc_extra_deps() here and call
@@ -197,22 +231,26 @@ load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependen
197231
apple_support_dependencies()
198232

199233
# End of C++ section
200-
201234
http_archive(
202235
name = "rules_proto",
203-
sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208",
204-
strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313",
205-
urls = [
206-
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
207-
"https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
208-
],
236+
sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295",
237+
strip_prefix = "rules_proto-6.0.2",
238+
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz",
209239
)
210240

211-
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
241+
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
212242

213243
rules_proto_dependencies()
214244

215-
rules_proto_toolchains()
245+
http_archive(
246+
name = "rules_java",
247+
sha256 = "6901869e94443ef199517548b792190f845a90757a31b40285a7309cf8c10557",
248+
url = "https://github.com/bazelbuild/rules_java/releases/download/8.6.1/rules_java-8.6.1.tar.gz",
249+
)
250+
251+
load("@rules_java//java:rules_java_deps.bzl", "rules_java_dependencies")
252+
253+
rules_java_dependencies()
216254

217255
##############################################################################
218256
# Go
@@ -315,6 +353,7 @@ load("@envoy_api//bazel:repositories.bzl", "api_dependencies")
315353
api_dependencies()
316354

317355
maven_install(
356+
name = "maven",
318357
artifacts = [
319358
"com.google.api:gapic-generator-java:" + _gapic_generator_java_version,
320359
] + PROTOBUF_MAVEN_ARTIFACTS +
@@ -324,17 +363,19 @@ maven_install(
324363
generate_compat_repositories = True,
325364
repositories = [
326365
"m2Local",
327-
"https://repo.maven.apache.org/maven2/",
366+
"https://repo.maven.apache.org/maven2",
328367
],
329368
)
330369

331-
load("@maven//:compat.bzl", "compat_repositories")
332-
333-
compat_repositories()
334-
335370
##############################################################################
336371
# Python
337372
##############################################################################
373+
374+
# Load Python-specific gRPC deps
375+
load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps")
376+
377+
grpc_python_deps()
378+
338379
load("@rules_gapic//python:py_gapic_repositories.bzl", "py_gapic_repositories")
339380

340381
py_gapic_repositories()
@@ -357,14 +398,14 @@ load(
357398
"gapic_generator_python",
358399
"gapic_generator_register_toolchains",
359400
)
360-
load("@rules_python//python:repositories.bzl", "py_repositories")
361401

362402
py_repositories()
363403

364-
load("@rules_python//python:pip.bzl", "pip_parse")
365-
366404
pip_parse(
367405
name = "gapic_generator_python_pip_deps",
406+
extra_pip_args = [
407+
"--no-cache-dir",
408+
],
368409
requirements_lock = "@gapic_generator_python//:requirements.txt",
369410
)
370411

generator-versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"sha": null
1111
},
1212
"java": {
13-
"version": "2.67.0",
13+
"version": "2.65.0",
1414
"commit": null,
1515
"sha": null
1616
},

google/ai/generativelanguage/v1alpha/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ load(
372372

373373
csharp_proto_library(
374374
name = "generativelanguage_csharp_proto",
375-
extra_opts = [],
376375
deps = [":generativelanguage_proto"],
377376
)
378377

google/ai/generativelanguage/v1beta/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ load(
374374

375375
csharp_proto_library(
376376
name = "generativelanguage_csharp_proto",
377-
extra_opts = [],
378377
deps = [":generativelanguage_proto"],
379378
)
380379

google/ai/generativelanguage/v1beta3/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ ruby_gapic_assembly_pkg(
264264

265265
csharp_proto_library(
266266
name = "generativelanguage_csharp_proto",
267-
extra_opts = [],
268267
deps = [":generativelanguage_proto"],
269268
)
270269

google/analytics/admin/v1beta/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ load(
328328

329329
csharp_proto_library(
330330
name = "admin_csharp_proto",
331-
extra_opts = [],
332331
deps = [":admin_proto"],
333332
)
334333

google/api/cloudquotas/v1/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ load(
320320

321321
csharp_proto_library(
322322
name = "cloudquotas_csharp_proto",
323-
extra_opts = [],
324323
deps = [":cloudquotas_proto"],
325324
)
326325

google/api/servicemanagement/v1/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ ruby_gapic_assembly_pkg(
277277

278278
csharp_proto_library(
279279
name = "servicemanagement_csharp_proto",
280-
extra_opts = [],
281280
deps = [":servicemanagement_proto"],
282281
)
283282

0 commit comments

Comments
 (0)