This is an automated email from the ASF dual-hosted git repository.

pjfanning pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-grpc.git


The following commit(s) were added to refs/heads/main by this push:
     new 150f0179 Update protobuf-java to 4.36.0 (#854)
150f0179 is described below

commit 150f0179b015be4dd4aabeca78ea9168b4dc2f10
Author: Scala Steward <[email protected]>
AuthorDate: Tue Aug 25 18:19:37 2026 +0200

    Update protobuf-java to 4.36.0 (#854)
    
    * Update protobuf-java to 4.36.0
    
    * more refs
    
    * Stop duplicate com.google.protobuf gencode shadowing protobuf-java
    
    Motivation:
    The gen-scala-server/00-interop scripted test fails with protobuf-java 
4.36.0:
    
      IllegalArgumentException: Edition EDITION_PROTO2 is greater than the
      maximum supported edition EDITION_UNKNOWN!
    
    That test depends on grpc-interop-testing in the "protobuf-src" 
configuration
    and generates Java as well as Scala, so protoc also compiles the
    google/protobuf/*.proto extracted from the transitive protobuf-java into
    com.google.protobuf gencode. Those classes shadow the real protobuf-java on
    the classpath, and the "protobuf-src" configuration resolves protobuf-java
    independently of the pinned version, so the gencode came from 4.34.0 while 
the
    runtime was 4.36.0. 4.34.0's Edition enum has no EDITION_2026, which 4.36.0
    declares as its maximum edition, so the shadowing FeatureSetDefaults 
reported
    EDITION_UNKNOWN. With 4.35.1 the maximum was EDITION_2024, which that 
gencode
    knows, so the duplicate classes stayed benign.
    
    Modification:
    Pass the pinned protobuf-java version to scripted tests and use it for the
    "protobuf-src" dependency in 00-interop, so the extracted well-known-type
    protos match the runtime. Also keep the duplicate com.google.protobuf 
gencode
    out of that test's compilation, as the interop-tests project already does.
    Extract the interop-tests well-known-type protos from the same pinned
    protobuf-java rather than the older one grpc brings in.
    
    Result:
    The gencode no longer shadows protobuf-java, and the interop scripted test
    passes on protobuf-java 4.36.0.
    
    Tests:
    - sbt "sbt-plugin / scripted gen-scala-server/00-interop" - passed (failed
      before this change with the error above)
    - sbt "interop-tests / Test / compile" - passed
    - sbt scalafmtSbtCheck - passed
    
    References:
    Refs #854
    
    ---------
    
    Co-authored-by: PJ Fanning <[email protected]>
---
 build.sbt                                                     |  1 +
 .../apache/pekko/grpc/gradle/PekkoGrpcPluginExtension.groovy  |  2 +-
 maven-plugin/src/main/maven/plugin.xml                        |  4 ++--
 project/Dependencies.scala                                    |  7 +++++--
 sbt-plugin/src/sbt-test/gen-scala-server/00-interop/build.sbt | 11 +++++++++++
 5 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/build.sbt b/build.sbt
index fe79beea..a0ecbfb5 100644
--- a/build.sbt
+++ b/build.sbt
@@ -194,6 +194,7 @@ lazy val sbtPlugin = Project(id = "sbt-plugin", base = 
file("sbt-plugin"))
     scriptedSbt := (pluginCrossBuild / sbtVersion).value,
     scriptedLaunchOpts += ("-Dproject.version=" + version.value),
     scriptedLaunchOpts += ("-Dpekko.grpc.scala3.next.version=" + 
Dependencies.Versions.scala3Next),
+    scriptedLaunchOpts += ("-Dgoogle.protobuf.version=" + 
Dependencies.Versions.googleProtobufJava),
     scriptedLaunchOpts ++= sys.props.collect { case (k @ "sbt.ivy.home", v) => 
s"-D$k=$v" }.toSeq,
     scriptedDependencies := {
       val p1 = publishLocal.value
diff --git 
a/gradle-plugin/src/main/groovy/org/apache/pekko/grpc/gradle/PekkoGrpcPluginExtension.groovy
 
b/gradle-plugin/src/main/groovy/org/apache/pekko/grpc/gradle/PekkoGrpcPluginExtension.groovy
index 6b866e31..f7ce20d0 100644
--- 
a/gradle-plugin/src/main/groovy/org/apache/pekko/grpc/gradle/PekkoGrpcPluginExtension.groovy
+++ 
b/gradle-plugin/src/main/groovy/org/apache/pekko/grpc/gradle/PekkoGrpcPluginExtension.groovy
@@ -14,7 +14,7 @@ import org.gradle.api.Project
 
 class PekkoGrpcPluginExtension {
 
-    static final String PROTOC_VERSION = "4.35.1" // checked synced by 
VersionSyncCheckPlugin
+    static final String PROTOC_VERSION = "4.36.0" // checked synced by 
VersionSyncCheckPlugin
 
     static final String PROTOC_PLUGIN_SCALA_VERSION = "2.12"
 
diff --git a/maven-plugin/src/main/maven/plugin.xml 
b/maven-plugin/src/main/maven/plugin.xml
index 9989908b..da680380 100644
--- a/maven-plugin/src/main/maven/plugin.xml
+++ b/maven-plugin/src/main/maven/plugin.xml
@@ -99,7 +99,7 @@
         <extraGenerators implementation="java.util.List" default-value=""/>
         <protoPaths 
default-value="${project.basedir}/src/main/proto,${project.basedir}/src/main/protobuf">${pekko-grpc.protoPaths}</protoPaths>
         <outputDirectory 
default-value="${project.build.directory}/generated-sources">${pekko-grpc.outputDirectory}</outputDirectory>
-        <protocVersion implementation="java.lang.String" 
default-value="-v4.35.1">${pekko-grpc.protoc-version}</protocVersion> <!-- 
checked synced by VersionSyncCheckPlugin -->
+        <protocVersion implementation="java.lang.String" 
default-value="-v4.36.0">${pekko-grpc.protoc-version}</protocVersion> <!-- 
checked synced by VersionSyncCheckPlugin -->
         <includeStdTypes implementation="boolean" default-value="false" />
       </configuration>
     </mojo>
@@ -191,7 +191,7 @@
         <extraGenerators implementation="java.util.List" default-value=""/>
         <protoPaths 
default-value="src/test/proto,src/test/protobuf">${pekko-grpc.protoPaths}</protoPaths>
         <outputDirectory 
default-value="target/generated-test-sources">${pekko-grpc.outputDirectory}</outputDirectory>
-        <protocVersion implementation="java.lang.String" 
default-value="-v4.35.1">${pekko-grpc.protoc-version}</protocVersion> <!-- 
checked synced by VersionSyncCheckPlugin -->
+        <protocVersion implementation="java.lang.String" 
default-value="-v4.36.0">${pekko-grpc.protoc-version}</protocVersion> <!-- 
checked synced by VersionSyncCheckPlugin -->
         <includeStdTypes implementation="boolean" default-value="false" />
       </configuration>
     </mojo>
diff --git a/project/Dependencies.scala b/project/Dependencies.scala
index 04b53aa7..d6f57793 100644
--- a/project/Dependencies.scala
+++ b/project/Dependencies.scala
@@ -40,8 +40,8 @@ object Dependencies {
     // Even referenced explicitly in the sbt-plugin's sbt-tests
     // If changing this, remember to update protoc plugin version to align in
     // maven-plugin/src/main/maven/plugin.xml and 
org.apache.pekko.grpc.sbt.PekkoGrpcPlugin
-    val googleProtoc = "4.35.1" // checked synced by VersionSyncCheckPlugin
-    val googleProtobufJava = "4.35.1"
+    val googleProtoc = "4.36.0" // checked synced by VersionSyncCheckPlugin
+    val googleProtobufJava = "4.36.0"
 
     val scalaTest = "3.2.20"
 
@@ -136,6 +136,9 @@ object Dependencies {
   lazy val interopTests = l ++= Seq(
     Compile.grpcInteropTesting,
     Compile.grpcInteropTesting % "protobuf", // gets the proto files for 
interop tests
+    // grpc drags in an older protobuf-java; make sure the 
google/protobuf/*.proto we compile
+    // against match the protobuf-java we run against
+    Protobuf.googleCommonProtos,
     Runtime.logback,
     Test.scalaTest.withConfigurations(Some("compile"))) ++ Def.setting {
     Seq(
diff --git a/sbt-plugin/src/sbt-test/gen-scala-server/00-interop/build.sbt 
b/sbt-plugin/src/sbt-test/gen-scala-server/00-interop/build.sbt
index 67572aa0..6a42b674 100644
--- a/sbt-plugin/src/sbt-test/gen-scala-server/00-interop/build.sbt
+++ b/sbt-plugin/src/sbt-test/gen-scala-server/00-interop/build.sbt
@@ -15,6 +15,10 @@ val grpcVersion = "1.83.1" // checked synced by 
VersionSyncCheckPlugin
 
 libraryDependencies ++= Seq(
   "io.grpc" % "grpc-interop-testing" % grpcVersion % "protobuf-src",
+  // grpc-interop-testing pulls in an older protobuf-java. Since Java sources 
are generated
+  // here, its google/protobuf/*.proto would be compiled into 
com.google.protobuf gencode
+  // that shadows the protobuf-java runtime on the classpath. Pin the version 
we run against.
+  "com.google.protobuf" % "protobuf-java" % 
sys.props("google.protobuf.version") % "protobuf-src",
   "org.apache.pekko" %% "pekko-grpc-interop-tests" % 
sys.props("project.version") % "test",
   "org.scalatest" %% "scalatest" % "3.2.20" % Test,
   "org.junit.jupiter" % "junit-jupiter-api" % "6.1.3" % Test)
@@ -23,6 +27,13 @@ scalacOptions ++= List("-unchecked", "-deprecation", 
"-language:_", "-encoding",
 
 enablePlugins(PekkoGrpcPlugin)
 
+// Java sources are generated here, so protoc also emits gencode for the 
google/protobuf/*.proto
+// that come in via "protobuf-src". Those classes duplicate the ones in 
protobuf-java and shadow
+// them on the classpath, so keep them out of the compilation - same as the 
interop-tests project.
+Compile / sources := (Compile / sources).value.filterNot { f =>
+  f.getPath.replace('\\', '/').contains("/com/google/protobuf/")
+}
+
 // proto files from "io.grpc" % "grpc-interop-testing" contain duplicate Empty 
definitions;
 // * google/protobuf/empty.proto
 // * io/grpc/testing/integration/empty.proto


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to