From 1551cc7403e0f9bcb3b949be8c486ce207395c6b Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Thu, 13 Apr 2023 08:52:20 -0700 Subject: [PATCH] Upgrade Protobuf Java to 3.22.3 (aka 22.3) 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++. --- .bazelrc | 1 + all/build.gradle | 1 + alts/build.gradle | 2 +- authz/build.gradle | 3 ++- .../benchmarks/qps/AbstractConfigurationBuilder.java | 2 ++ examples/.bazelrc | 1 + examples/WORKSPACE | 2 ++ examples/android/clientcache/app/build.gradle | 2 +- examples/android/helloworld/app/build.gradle | 2 +- examples/android/routeguide/app/build.gradle | 2 +- examples/android/strictmode/app/build.gradle | 2 +- examples/build.gradle | 2 +- examples/example-alts/build.gradle | 2 +- examples/example-debug/build.gradle | 2 +- examples/example-debug/pom.xml | 7 ++++++- examples/example-gauth/build.gradle | 2 +- examples/example-gauth/pom.xml | 2 +- examples/example-gcp-observability/build.gradle | 2 +- examples/example-hostname/build.gradle | 2 +- examples/example-hostname/pom.xml | 7 ++++++- examples/example-jwt-auth/build.gradle | 2 +- examples/example-jwt-auth/pom.xml | 4 ++-- examples/example-orca/build.gradle | 2 +- examples/example-reflection/build.gradle | 2 +- examples/example-servlet/build.gradle | 2 +- examples/example-tls/build.gradle | 2 +- examples/example-tls/pom.xml | 2 +- examples/example-xds/build.gradle | 2 +- examples/pom.xml | 9 +++++++-- gcp-observability/build.gradle | 3 ++- googleapis/build.gradle | 2 +- gradle/libs.versions.toml | 3 ++- repositories.bzl | 12 ++++++------ services/build.gradle | 2 +- 34 files changed, 61 insertions(+), 36 deletions(-) create mode 100644 .bazelrc create mode 100644 examples/.bazelrc diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000000..554440cfe3 --- /dev/null +++ b/.bazelrc @@ -0,0 +1 @@ +build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 diff --git a/all/build.gradle b/all/build.gradle index e4d7e9085b..6b2c6226dc 100644 --- a/all/build.gradle +++ b/all/build.gradle @@ -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 { diff --git a/alts/build.gradle b/alts/build.gradle index 926a3d4993..4ae91fee29 100644 --- a/alts/build.gradle +++ b/alts/build.gradle @@ -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 diff --git a/authz/build.gradle b/authz/build.gradle index 50084752d0..b6815ce4c1 100644 --- a/authz/build.gradle +++ b/authz/build.gradle @@ -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 diff --git a/benchmarks/src/main/java/io/grpc/benchmarks/qps/AbstractConfigurationBuilder.java b/benchmarks/src/main/java/io/grpc/benchmarks/qps/AbstractConfigurationBuilder.java index fc74b1706e..1606b194d3 100644 --- a/benchmarks/src/main/java/io/grpc/benchmarks/qps/AbstractConfigurationBuilder.java +++ b/benchmarks/src/main/java/io/grpc/benchmarks/qps/AbstractConfigurationBuilder.java @@ -147,6 +147,7 @@ public abstract class AbstractConfigurationBuilder } @Override + @SuppressWarnings("InlineMeInliner") // String.repeat() requires Java 11 public final void printUsage() { System.out.println("Usage: [ARGS...]"); int column1Width = 0; @@ -210,6 +211,7 @@ public abstract class AbstractConfigurationBuilder 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; diff --git a/examples/.bazelrc b/examples/.bazelrc new file mode 100644 index 0000000000..554440cfe3 --- /dev/null +++ b/examples/.bazelrc @@ -0,0 +1 @@ +build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 diff --git a/examples/WORKSPACE b/examples/WORKSPACE index 671176a846..a83b872fd7 100644 --- a/examples/WORKSPACE +++ b/examples/WORKSPACE @@ -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") diff --git a/examples/android/clientcache/app/build.gradle b/examples/android/clientcache/app/build.gradle index 2fbf3dffab..a532fb2b8d 100644 --- a/examples/android/clientcache/app/build.gradle +++ b/examples/android/clientcache/app/build.gradle @@ -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 } diff --git a/examples/android/helloworld/app/build.gradle b/examples/android/helloworld/app/build.gradle index c9cef8221b..a78de9e2d2 100644 --- a/examples/android/helloworld/app/build.gradle +++ b/examples/android/helloworld/app/build.gradle @@ -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 } diff --git a/examples/android/routeguide/app/build.gradle b/examples/android/routeguide/app/build.gradle index 1a8ff5edeb..8947b4e1b6 100644 --- a/examples/android/routeguide/app/build.gradle +++ b/examples/android/routeguide/app/build.gradle @@ -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 } diff --git a/examples/android/strictmode/app/build.gradle b/examples/android/strictmode/app/build.gradle index 568624c8a8..210bb0b497 100644 --- a/examples/android/strictmode/app/build.gradle +++ b/examples/android/strictmode/app/build.gradle @@ -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 } diff --git a/examples/build.gradle b/examples/build.gradle index 333e6ec4f0..5255db3182 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -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 { diff --git a/examples/example-alts/build.gradle b/examples/example-alts/build.gradle index e05191348d..c9f9c7af20 100644 --- a/examples/example-alts/build.gradle +++ b/examples/example-alts/build.gradle @@ -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 diff --git a/examples/example-debug/build.gradle b/examples/example-debug/build.gradle index 6cdfd9ccdd..7be8312e1a 100644 --- a/examples/example-debug/build.gradle +++ b/examples/example-debug/build.gradle @@ -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}" diff --git a/examples/example-debug/pom.xml b/examples/example-debug/pom.xml index fbfef978a5..17a6e0ef5d 100644 --- a/examples/example-debug/pom.xml +++ b/examples/example-debug/pom.xml @@ -13,7 +13,7 @@ UTF-8 1.55.0-SNAPSHOT - 3.21.7 + 3.22.3 1.8 1.8 @@ -55,6 +55,11 @@ grpc-netty-shaded runtime + + com.google.guava + guava + 31.1-jre + junit junit diff --git a/examples/example-gauth/build.gradle b/examples/example-gauth/build.gradle index 007f9bb702..d4f74d1a8d 100644 --- a/examples/example-gauth/build.gradle +++ b/examples/example-gauth/build.gradle @@ -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 diff --git a/examples/example-gauth/pom.xml b/examples/example-gauth/pom.xml index 0fac8c25e0..78435e5e22 100644 --- a/examples/example-gauth/pom.xml +++ b/examples/example-gauth/pom.xml @@ -13,7 +13,7 @@ UTF-8 1.55.0-SNAPSHOT - 3.21.7 + 3.22.3 1.8 1.8 diff --git a/examples/example-gcp-observability/build.gradle b/examples/example-gcp-observability/build.gradle index 5d8571aefe..318ceb59cd 100644 --- a/examples/example-gcp-observability/build.gradle +++ b/examples/example-gcp-observability/build.gradle @@ -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}" diff --git a/examples/example-hostname/build.gradle b/examples/example-hostname/build.gradle index 7913f0b3b4..f127675e20 100644 --- a/examples/example-hostname/build.gradle +++ b/examples/example-hostname/build.gradle @@ -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}" diff --git a/examples/example-hostname/pom.xml b/examples/example-hostname/pom.xml index ca1cfe2121..6dcfafab1a 100644 --- a/examples/example-hostname/pom.xml +++ b/examples/example-hostname/pom.xml @@ -13,7 +13,7 @@ UTF-8 1.55.0-SNAPSHOT - 3.21.7 + 3.22.3 1.8 1.8 @@ -55,6 +55,11 @@ grpc-netty-shaded runtime + + com.google.guava + guava + 31.1-jre + junit junit diff --git a/examples/example-jwt-auth/build.gradle b/examples/example-jwt-auth/build.gradle index 0fe90b3f30..b07eed4269 100644 --- a/examples/example-jwt-auth/build.gradle +++ b/examples/example-jwt-auth/build.gradle @@ -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 { diff --git a/examples/example-jwt-auth/pom.xml b/examples/example-jwt-auth/pom.xml index dbd684516e..8bae800357 100644 --- a/examples/example-jwt-auth/pom.xml +++ b/examples/example-jwt-auth/pom.xml @@ -14,8 +14,8 @@ UTF-8 1.55.0-SNAPSHOT - 3.21.7 - 3.21.7 + 3.22.3 + 3.22.3 1.8 1.8 diff --git a/examples/example-orca/build.gradle b/examples/example-orca/build.gradle index d697081c08..2973be425b 100644 --- a/examples/example-orca/build.gradle +++ b/examples/example-orca/build.gradle @@ -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}" diff --git a/examples/example-reflection/build.gradle b/examples/example-reflection/build.gradle index d6aee016c1..6168a6f466 100644 --- a/examples/example-reflection/build.gradle +++ b/examples/example-reflection/build.gradle @@ -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}" diff --git a/examples/example-servlet/build.gradle b/examples/example-servlet/build.gradle index f6772cda51..621f3c6ced 100644 --- a/examples/example-servlet/build.gradle +++ b/examples/example-servlet/build.gradle @@ -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}", diff --git a/examples/example-tls/build.gradle b/examples/example-tls/build.gradle index 3cd48200fe..821203c21d 100644 --- a/examples/example-tls/build.gradle +++ b/examples/example-tls/build.gradle @@ -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}" diff --git a/examples/example-tls/pom.xml b/examples/example-tls/pom.xml index c6dd141edd..e9608e05dc 100644 --- a/examples/example-tls/pom.xml +++ b/examples/example-tls/pom.xml @@ -13,7 +13,7 @@ UTF-8 1.55.0-SNAPSHOT - 3.21.7 + 3.22.3 2.0.56.Final 1.8 diff --git a/examples/example-xds/build.gradle b/examples/example-xds/build.gradle index 9761804060..5b03f2ccec 100644 --- a/examples/example-xds/build.gradle +++ b/examples/example-xds/build.gradle @@ -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}" diff --git a/examples/pom.xml b/examples/pom.xml index 13f8164fb4..c02a8f262b 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -13,8 +13,8 @@ UTF-8 1.55.0-SNAPSHOT - 3.21.7 - 3.21.7 + 3.22.3 + 3.22.3 1.8 1.8 @@ -60,6 +60,11 @@ gson 2.9.0 + + com.google.guava + guava + 31.1-jre + org.apache.tomcat annotations-api diff --git a/gcp-observability/build.gradle b/gcp-observability/build.gradle index 63850efc4e..0c6a933d7d 100644 --- a/gcp-observability/build.gradle +++ b/gcp-observability/build.gradle @@ -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'), diff --git a/googleapis/build.gradle b/googleapis/build.gradle index d829b1d28e..928466222a 100644 --- a/googleapis/build.gradle +++ b/googleapis/build.gradle @@ -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 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3217767ba5..0ac68f94dc 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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" @@ -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" diff --git a/repositories.bzl b/repositories.bzl index 3245427737..2e3b2b62c0 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -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(): diff --git a/services/build.gradle b/services/build.gradle index b6d945c7e9..4b445c2d1e 100644 --- a/services/build.gradle +++ b/services/build.gradle @@ -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