Skip to content

Commit c886f0a

Browse files
authored
Upgrade to Protobuf 35.1 (#12876)
Per https://github.com/protocolbuffers/protobuf/releases ``` okshiva@okshiva-mac2 grpc-java % curl -sL https://github.com/protocolbuffers/protobuf/releases/download/v35.1/protobuf-35.1.tar.gz | shasum -a 256 f0b6838e7522a8da96126d487068c959bc624926368f3024ac8fd03abd0a1ac4 ``` While upgrading Protobuf to 35.1, two secondary Bazel dependencies (`rules_proto` and `rules_android`) had to be addressed to keep the CI green. Here is the context: 1. Added `rules_proto` to `repositories.bzl` and `MODULE.bazel`. The googleapis dependency requires `rules_proto` to build. During the CI job (--enable_bzlmod=false), the build failed during the analysis phase because googleapis could no longer implicitly fetch `rules_proto` via Protobuf. 2. Upgraded to rules_android v0.7.3 Previous version of `rules_android` (v0.7.2) explicitly hardcoded "`com.google.protobuf:protobuf-java:4.33.4`" in its internal maven artifacts. During the Android CI job, Bazel used our newly upgraded 35.1 compiler to generate internal Android resource files (gencode 4.35.1). However, because `rules_android`'s internal tools (like `ResourceProcessorBusyBox`) were locked to the 4.33.4 runtime, it triggered a `ProtobufRuntimeVersionException` (poison pill).
1 parent 63bbd3c commit c886f0a

6 files changed

Lines changed: 17 additions & 9 deletions

File tree

MODULE.bazel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ bazel_dep(name = "bazel_jar_jar", version = "0.1.11.bcr.1")
5454
bazel_dep(name = "bazel_skylib", version = "1.7.1")
5555
bazel_dep(name = "googleapis", version = "0.0.0-20260514-1dbb1a14", repo_name = "com_google_googleapis")
5656
bazel_dep(name = "grpc-proto", version = "0.0.0-20240627-ec30f58.bcr.1", repo_name = "io_grpc_grpc_proto")
57-
bazel_dep(name = "protobuf", version = "33.4", repo_name = "com_google_protobuf")
58-
bazel_dep(name = "rules_android", version = "0.7.2")
57+
bazel_dep(name = "protobuf", version = "35.1", repo_name = "com_google_protobuf")
58+
bazel_dep(name = "rules_proto", version = "7.1.0")
59+
bazel_dep(name = "rules_android", version = "0.7.3")
5960
bazel_dep(name = "rules_cc", version = "0.0.9")
6061
bazel_dep(name = "rules_java", version = "9.1.0")
6162
bazel_dep(name = "rules_jvm_external", version = "6.0")

buildscripts/kokoro/windows32.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ cd "%WORKSPACE%"
2525

2626
SET TARGET_ARCH=x86_32
2727
SET FAIL_ON_WARNINGS=true
28-
SET PROTOBUF_VER=33.4
28+
SET PROTOBUF_VER=35.1
2929
SET PKG_CONFIG_PATH=%ESCWORKSPACE%\\grpc-java-helper32\\protobuf-%PROTOBUF_VER%\\build\\protobuf-%PROTOBUF_VER%\\lib\\pkgconfig
3030
SET VC_PROTOBUF_LIBS=/LIBPATH:%ESCWORKSPACE%\\grpc-java-helper32\\protobuf-%PROTOBUF_VER%\\build\\protobuf-%PROTOBUF_VER%\\lib
3131
SET VC_PROTOBUF_INCLUDE=%ESCWORKSPACE%\\grpc-java-helper32\\protobuf-%PROTOBUF_VER%\\build\\protobuf-%PROTOBUF_VER%\\include

buildscripts/kokoro/windows64.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ cd "%WORKSPACE%"
2424

2525
SET TARGET_ARCH=x86_64
2626
SET FAIL_ON_WARNINGS=true
27-
SET PROTOBUF_VER=33.4
27+
SET PROTOBUF_VER=35.1
2828
SET PKG_CONFIG_PATH=%ESCWORKSPACE%\\grpc-java-helper64\\protobuf-%PROTOBUF_VER%\\build\\protobuf-%PROTOBUF_VER%\\lib\\pkgconfig
2929
SET VC_PROTOBUF_LIBS=/LIBPATH:%ESCWORKSPACE%\\grpc-java-helper64\\protobuf-%PROTOBUF_VER%\\build\\protobuf-%PROTOBUF_VER%\\lib
3030
SET VC_PROTOBUF_INCLUDE=%ESCWORKSPACE%\\grpc-java-helper64\\protobuf-%PROTOBUF_VER%\\build\\protobuf-%PROTOBUF_VER%\\include

buildscripts/make_dependencies.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
choco install -y pkgconfiglite
22
choco install -y openjdk --version=17.0
33
set PATH=%PATH%;"c:\Program Files\OpenJDK\jdk-17\bin"
4-
set PROTOBUF_VER=33.4
4+
set PROTOBUF_VER=35.1
55
set ABSL_VERSION=20250127.1
66
set CMAKE_NAME=cmake-3.26.3-windows-x86_64
77

buildscripts/make_dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Build protoc
44
set -evux -o pipefail
55

6-
PROTOBUF_VERSION=33.4
6+
PROTOBUF_VERSION=35.1
77
ABSL_VERSION=20250127.1
88

99
# ARCH is x86_64 bit unless otherwise specified.

repositories.bzl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ def grpc_java_repositories():
104104
"https://github.com/googleapis/googleapis/archive/1dbb1a14e079f78d9214f8e48bf083f32e3ddb96.tar.gz",
105105
],
106106
)
107+
if not native.existing_rule("rules_proto"):
108+
http_archive(
109+
name = "rules_proto",
110+
sha256 = "14a225870ab4e91869652cfd69ef2028277fc1dc4910d65d353b62d6e0ae21f4",
111+
strip_prefix = "rules_proto-7.1.0",
112+
urls = ["https://github.com/bazelbuild/rules_proto/releases/download/7.1.0/rules_proto-7.1.0.tar.gz"],
113+
)
107114
if not native.existing_rule("io_grpc_grpc_proto"):
108115
io_grpc_grpc_proto()
109116
if not native.existing_rule("bazel_jar_jar"):
@@ -120,9 +127,9 @@ def com_google_protobuf():
120127
# This statement defines the @com_google_protobuf repo.
121128
http_archive(
122129
name = "com_google_protobuf",
123-
sha256 = "bc670a4e34992c175137ddda24e76562bb928f849d712a0e3c2fb2e19249bea1",
124-
strip_prefix = "protobuf-33.4",
125-
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v33.4/protobuf-33.4.tar.gz"],
130+
sha256 = "f0b6838e7522a8da96126d487068c959bc624926368f3024ac8fd03abd0a1ac4",
131+
strip_prefix = "protobuf-35.1",
132+
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v35.1/protobuf-35.1.tar.gz"],
126133
)
127134

128135
def io_grpc_grpc_proto():

0 commit comments

Comments
 (0)