Skip to content

Commit

Permalink
Upgrade Protobuf Java to 3.22.3 (aka 22.3)
Browse files Browse the repository at this point in the history
The version used by protoc-gen-grpc-java will be upgraded separately,
because of large C++ build changes necessary. But that won't impact
users at all. We are upgrading to protoc 22.3; only the grpc plugin is
not upgraded.

Bazel is upgraded for both Java and C++.
  • Loading branch information
ejona86 committed Apr 17, 2023
1 parent bcbdb20 commit 1551cc7
Show file tree
Hide file tree
Showing 34 changed files with 61 additions and 36 deletions.
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
1 change: 1 addition & 0 deletions all/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ evaluationDependsOn(':grpc-interop-testing')

dependencies {
api subprojects.minus([project(':grpc-protobuf-lite')])
implementation libraries.guava.jre // JRE required by transitive protobuf-java-util
}

tasks.named("javadoc").configure {
Expand Down
2 changes: 1 addition & 1 deletion alts/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies {
project(':grpc-stub'),
libraries.protobuf.java,
libraries.conscrypt,
libraries.guava,
libraries.guava.jre, // JRE required by protobuf-java-util from grpclb
libraries.google.auth.oauth2Http
def nettyDependency = implementation project(':grpc-netty')
compileOnly libraries.javax.annotation
Expand Down
3 changes: 2 additions & 1 deletion authz/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ description = "gRPC: Authorization"

dependencies {
implementation project(':grpc-protobuf'),
project(':grpc-core')
project(':grpc-core'),
libraries.guava.jre // JRE required by transitive protobuf-java-util

annotationProcessor libraries.auto.value
compileOnly libraries.javax.annotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public final T build(String[] args) {
}

@Override
@SuppressWarnings("InlineMeInliner") // String.repeat() requires Java 11
public final void printUsage() {
System.out.println("Usage: [ARGS...]");
int column1Width = 0;
Expand Down Expand Up @@ -210,6 +211,7 @@ private static String commandLineFlag(Param param) {
return "--" + name + type;
}

@SuppressWarnings("InlineMeInliner") // String.repeat() requires Java 11
private static String wordWrap(String text, int startPos, int maxPos) {
StringBuilder builder = new StringBuilder();
int pos = startPos;
Expand Down
1 change: 1 addition & 0 deletions examples/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
2 changes: 2 additions & 0 deletions examples/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ load("@io_grpc_grpc_java//:repositories.bzl", "grpc_java_repositories")

grpc_java_repositories()

# Protobuf now requires C++14 or higher, which requires Bazel configuration
# outside the WORKSPACE. See .bazelrc in this directory.
load("@com_google_protobuf//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS")
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

Expand Down
2 changes: 1 addition & 1 deletion examples/android/clientcache/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ android {
}

protobuf {
protoc { artifact = 'com.google.protobuf:protoc:3.21.7' }
protoc { artifact = 'com.google.protobuf:protoc:3.22.3' }
plugins {
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
}
Expand Down
2 changes: 1 addition & 1 deletion examples/android/helloworld/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ android {
}

protobuf {
protoc { artifact = 'com.google.protobuf:protoc:3.21.7' }
protoc { artifact = 'com.google.protobuf:protoc:3.22.3' }
plugins {
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
}
Expand Down
2 changes: 1 addition & 1 deletion examples/android/routeguide/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ android {
}

protobuf {
protoc { artifact = 'com.google.protobuf:protoc:3.21.7' }
protoc { artifact = 'com.google.protobuf:protoc:3.22.3' }
plugins {
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
}
Expand Down
2 changes: 1 addition & 1 deletion examples/android/strictmode/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ android {
}

protobuf {
protoc { artifact = 'com.google.protobuf:protoc:3.21.7' }
protoc { artifact = 'com.google.protobuf:protoc:3.22.3' }
plugins {
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
}
Expand Down
2 changes: 1 addition & 1 deletion examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ targetCompatibility = 1.8
// Feel free to delete the comment at the next line. It is just for safely
// updating the version in our release process.
def grpcVersion = '1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protobufVersion = '3.21.7'
def protobufVersion = '3.22.3'
def protocVersion = protobufVersion

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion examples/example-alts/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ targetCompatibility = 1.8
// Feel free to delete the comment at the next line. It is just for safely
// updating the version in our release process.
def grpcVersion = '1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protocVersion = '3.21.7'
def protocVersion = '3.22.3'

dependencies {
// grpc-alts transitively depends on grpc-netty-shaded, grpc-protobuf, and grpc-stub
Expand Down
2 changes: 1 addition & 1 deletion examples/example-debug/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ targetCompatibility = 1.8
// Feel free to delete the comment at the next line. It is just for safely
// updating the version in our release process.
def grpcVersion = '1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protobufVersion = '3.21.7'
def protobufVersion = '3.22.3'

dependencies {
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
Expand Down
7 changes: 6 additions & 1 deletion examples/example-debug/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<grpc.version>1.55.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
<protoc.version>3.21.7</protoc.version>
<protoc.version>3.22.3</protoc.version>
<!-- required for jdk9 -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down Expand Up @@ -55,6 +55,11 @@
<artifactId>grpc-netty-shaded</artifactId>
<scope>runtime</scope>
</dependency>
<dependency> <!-- prevent downgrade of version in protobuf-java-util from grpc-services -->
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-gauth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ targetCompatibility = 1.8
// Feel free to delete the comment at the next line. It is just for safely
// updating the version in our release process.
def grpcVersion = '1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protobufVersion = '3.21.7'
def protobufVersion = '3.22.3'
def protocVersion = protobufVersion


Expand Down
2 changes: 1 addition & 1 deletion examples/example-gauth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<grpc.version>1.55.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
<protobuf.version>3.21.7</protobuf.version>
<protobuf.version>3.22.3</protobuf.version>
<!-- required for jdk9 -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-gcp-observability/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ targetCompatibility = 1.8
// Feel free to delete the comment at the next line. It is just for safely
// updating the version in our release process.
def grpcVersion = '1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protocVersion = '3.21.7'
def protocVersion = '3.22.3'

dependencies {
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
Expand Down
2 changes: 1 addition & 1 deletion examples/example-hostname/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ targetCompatibility = 1.8
// Feel free to delete the comment at the next line. It is just for safely
// updating the version in our release process.
def grpcVersion = '1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protobufVersion = '3.21.7'
def protobufVersion = '3.22.3'

dependencies {
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
Expand Down
7 changes: 6 additions & 1 deletion examples/example-hostname/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<grpc.version>1.55.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
<protoc.version>3.21.7</protoc.version>
<protoc.version>3.22.3</protoc.version>
<!-- required for jdk9 -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down Expand Up @@ -55,6 +55,11 @@
<artifactId>grpc-netty-shaded</artifactId>
<scope>runtime</scope>
</dependency>
<dependency> <!-- prevent downgrade of version in protobuf-java-util from grpc-services -->
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-jwt-auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ targetCompatibility = 1.8
// Feel free to delete the comment at the next line. It is just for safely
// updating the version in our release process.
def grpcVersion = '1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protobufVersion = '3.21.7'
def protobufVersion = '3.22.3'
def protocVersion = protobufVersion

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions examples/example-jwt-auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<grpc.version>1.55.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
<protobuf.version>3.21.7</protobuf.version>
<protoc.version>3.21.7</protoc.version>
<protobuf.version>3.22.3</protobuf.version>
<protoc.version>3.22.3</protoc.version>
<!-- required for jdk9 -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-orca/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8

def grpcVersion = '1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protocVersion = '3.21.7'
def protocVersion = '3.22.3'

dependencies {
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
Expand Down
2 changes: 1 addition & 1 deletion examples/example-reflection/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8

def grpcVersion = '1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protocVersion = '3.21.7'
def protocVersion = '3.22.3'

dependencies {
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
Expand Down
2 changes: 1 addition & 1 deletion examples/example-servlet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8

def grpcVersion = '1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protocVersion = '3.21.7'
def protocVersion = '3.22.3'

dependencies {
implementation "io.grpc:grpc-protobuf:${grpcVersion}",
Expand Down
2 changes: 1 addition & 1 deletion examples/example-tls/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ targetCompatibility = 1.8
// Feel free to delete the comment at the next line. It is just for safely
// updating the version in our release process.
def grpcVersion = '1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def protocVersion = '3.21.7'
def protocVersion = '3.22.3'

dependencies {
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
Expand Down
2 changes: 1 addition & 1 deletion examples/example-tls/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<grpc.version>1.55.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
<protoc.version>3.21.7</protoc.version>
<protoc.version>3.22.3</protoc.version>
<netty.tcnative.version>2.0.56.Final</netty.tcnative.version>
<!-- required for jdk9 -->
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-xds/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ targetCompatibility = 1.8
// updating the version in our release process.
def grpcVersion = '1.55.0-SNAPSHOT' // CURRENT_GRPC_VERSION
def nettyTcNativeVersion = '2.0.56.Final'
def protocVersion = '3.21.7'
def protocVersion = '3.22.3'

dependencies {
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
Expand Down
9 changes: 7 additions & 2 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<grpc.version>1.55.0-SNAPSHOT</grpc.version><!-- CURRENT_GRPC_VERSION -->
<protobuf.version>3.21.7</protobuf.version>
<protoc.version>3.21.7</protoc.version>
<protobuf.version>3.22.3</protobuf.version>
<protoc.version>3.22.3</protoc.version>
<!-- required for JDK 8 -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down Expand Up @@ -60,6 +60,11 @@
<artifactId>gson</artifactId>
<version>2.9.0</version> <!-- prevent downgrade via protobuf-java-util -->
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version> <!-- prevent downgrade of version in protobuf-java-util -->
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>annotations-api</artifactId>
Expand Down
3 changes: 2 additions & 1 deletion gcp-observability/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ dependencies {
libraries.opencensus.exporter.trace.stackdriver,
project(':grpc-xds'), // Align grpc versions
project(':grpc-services'), // Align grpc versions
('com.google.protobuf:protobuf-java:3.21.12'),
libraries.protobuf.java,
libraries.protobuf.java.util, // Use our newer version
('com.google.api.grpc:proto-google-common-protos:2.14.2'),
('com.google.auth:google-auth-library-oauth2-http:1.16.0'),
('io.opencensus:opencensus-api:0.31.1'),
Expand Down
2 changes: 1 addition & 1 deletion googleapis/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies {
implementation project(':grpc-alts'),
project(':grpc-core'),
project(':grpc-xds'),
libraries.guava
libraries.guava.jre // JRE required by transitive protobuf-java-util
testImplementation project(':grpc-core').sourceSets.test.output

signature libraries.signature.java
Expand Down
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ guava = "31.1-android"
netty = '4.1.87.Final'
nettytcnative = '2.0.56.Final'
opencensus = "0.31.0"
protobuf = "3.21.7"
protobuf = "3.22.3"

[libraries]
android-annotations = "com.google.android:annotations:4.1.1.4"
Expand Down Expand Up @@ -36,6 +36,7 @@ gson = "com.google.code.gson:gson:2.9.0"
guava = { module = "com.google.guava:guava", version.ref = "guava" }
guava-betaChecker = "com.google.guava:guava-beta-checker:1.0"
guava-testlib = { module = "com.google.guava:guava-testlib", version.ref = "guava" }
guava-jre = "com.google.guava:guava:31.1-jre"
hdrhistogram = "org.hdrhistogram:HdrHistogram:2.1.12"
javax-annotation = "org.apache.tomcat:annotations-api:6.0.53"
jetty-alpn-agent = "org.mortbay.jetty.alpn:jetty-alpn-agent:2.0.10"
Expand Down
12 changes: 6 additions & 6 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,18 @@ def com_google_protobuf():
# This statement defines the @com_google_protobuf repo.
http_archive(
name = "com_google_protobuf",
sha256 = "c72840a5081484c4ac20789ea5bb5d5de6bc7c477ad76e7109fda2bc4e630fe6",
strip_prefix = "protobuf-3.21.7",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.21.7.zip"],
sha256 = "5d0f05587aa3ad56079b4c4481dcb462267e5f1075d905c321f8ed6339e74ab0",
strip_prefix = "protobuf-22.3",
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v22.3/protobuf-22.3.zip"],
)

def com_google_protobuf_javalite():
# java_lite_proto_library rules implicitly depend on @com_google_protobuf_javalite
http_archive(
name = "com_google_protobuf_javalite",
sha256 = "c72840a5081484c4ac20789ea5bb5d5de6bc7c477ad76e7109fda2bc4e630fe6",
strip_prefix = "protobuf-3.21.7",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.21.7.zip"],
sha256 = "5d0f05587aa3ad56079b4c4481dcb462267e5f1075d905c321f8ed6339e74ab0",
strip_prefix = "protobuf-22.3",
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v22.3/protobuf-22.3.zip"],
)

def io_grpc_grpc_proto():
Expand Down
2 changes: 1 addition & 1 deletion services/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies {
project(':grpc-stub'),
project(':grpc-core')
implementation libraries.protobuf.java.util,
libraries.guava
libraries.guava.jre // JRE required by protobuf-java-util

runtimeOnly libraries.errorprone.annotations

Expand Down

0 comments on commit 1551cc7

Please sign in to comment.