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 cdb60e3b scalapb 1.0.0 alpha support protobuf 4 (#610)
cdb60e3b is described below
commit cdb60e3bf8ebffbfb12ac83bea7badf3b2072f13
Author: PJ Fanning <[email protected]>
AuthorDate: Fri May 29 10:47:55 2026 +0100
scalapb 1.0.0 alpha support protobuf 4 (#610)
* scalapb 1.0.0 alpha support protobuf 4
* workaround issue with _root_ prefix
* try to fix sbt tests
* Reorder plugin enabling and eviction error level
* Update plugins.sbt for ScalaPB Validate support
* stick with protobuf 4.32
* interop-tests issue
* Update build.sbt
* remove tab
---
build.sbt | 14 ++++++++++++--
.../scala/org/apache/pekko/grpc/gen/scaladsl/Service.scala | 8 +++++++-
.../pekko/grpc/gradle/PekkoGrpcPluginExtension.groovy | 2 +-
maven-plugin/src/main/maven/plugin.xml | 4 ++--
project/Dependencies.scala | 4 ++--
project/plugins.sbt | 2 +-
.../gen-scala-server/10-scalapb-validate/build.sbt | 3 +++
.../10-scalapb-validate/project/plugins.sbt | 3 +++
8 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/build.sbt b/build.sbt
index ac11a373..28e7b26d 100644
--- a/build.sbt
+++ b/build.sbt
@@ -177,7 +177,7 @@ lazy val sbtPlugin = Project(id = "sbt-plugin", base =
file("sbt-plugin"))
val p3 = (runtime / publishLocal).value
val p4 = (interopTests / publishLocal).value
},
- scriptedSbt := "1.12.9",
+ scriptedSbt := "1.12.11",
scriptedBufferLog := false)
.settings(
crossScalaVersions := Dependencies.Versions.CrossScalaForPlugin,
@@ -209,6 +209,11 @@ lazy val interopTests = Project(id = "interop-tests", base
= file("interop-tests
// We need to be able to publish locally in order for sbt interopt tests
to work
// however this sbt project should not be published to an actual repository
publishLocal / skip := false,
+ // the following is needed to exclude the gRPC generated sources for
protobuf-java from the sources,
+ // they cause tests to fail - https://github.com/apache/pekko-grpc/pull/610
+ Compile / sources := (Compile / sources).value.filterNot { f =>
+ f.getPath.replace('\\',
'/').contains("/src_managed/main/com/google/protobuf")
+ },
Compile / doc := (Compile / doc / target).value)
.settings(inConfig(Test)(Seq(
reStart / mainClass := (Test / run / mainClass).value, {
@@ -310,7 +315,12 @@ lazy val pluginTesterScala = Project(id =
"plugin-tester-scala", base = file("pl
PB.protocVersion := Dependencies.Versions.googleProtoc,
crossScalaVersions := Dependencies.Versions.CrossScalaForLib,
scalaVersion := Dependencies.Versions.CrossScalaForLib.head,
- ReflectiveCodeGen.codeGeneratorSettings ++= Seq("flat_package",
"server_power_apis"))
+ ReflectiveCodeGen.codeGeneratorSettings ++= Seq("flat_package",
"server_power_apis"),
+ // the following is needed to exclude the gRPC generated sources for
protobuf-java from the sources,
+ // they cause tests to fail - https://github.com/apache/pekko-grpc/pull/610
+ Compile / sources := (Compile / sources).value.filterNot { f =>
+ f.getPath.replace('\\',
'/').contains("/src_managed/main/com/google/protobuf")
+ })
.pluginTestingSettings
.enablePlugins(NoPublish)
diff --git
a/codegen/src/main/scala/org/apache/pekko/grpc/gen/scaladsl/Service.scala
b/codegen/src/main/scala/org/apache/pekko/grpc/gen/scaladsl/Service.scala
index cbe94741..a120bc11 100644
--- a/codegen/src/main/scala/org/apache/pekko/grpc/gen/scaladsl/Service.scala
+++ b/codegen/src/main/scala/org/apache/pekko/grpc/gen/scaladsl/Service.scala
@@ -50,7 +50,7 @@ object Service {
Service(
fileDesc.fileDescriptorObject.fullName + ".javaDescriptor",
- fileDesc.scalaPackage.fullName,
+ trimRootPackage(fileDesc.scalaPackage.fullName),
serviceClassName,
(if (fileDesc.getPackage.isEmpty) "" else fileDesc.getPackage + ".") +
serviceDescriptor.getName,
serviceDescriptor.getMethods.asScala.map(method =>
Method(method)).toList,
@@ -60,4 +60,10 @@ object Service {
serviceDescriptor.comment,
new ScalaCompatConstants(fileDesc.emitScala3Sources))
}
+
+ private def trimRootPackage(packageName: String): String = {
+ val prefix = "_root_."
+ if (packageName.startsWith(prefix)) packageName.substring(prefix.length)
+ else packageName
+ }
}
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 3732421d..0ad9a97a 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 = "3.25.9" // checked synced by
VersionSyncCheckPlugin
+ static final String PROTOC_VERSION = "4.32.1" // 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 c201acf6..7f99367f 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="-v3.25.9">${pekko-grpc.protoc-version}</protocVersion> <!--
checked synced by VersionSyncCheckPlugin -->
+ <protocVersion implementation="java.lang.String"
default-value="-v4.32.1">${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="-v3.25.9">${pekko-grpc.protoc-version}</protocVersion> <!--
checked synced by VersionSyncCheckPlugin -->
+ <protocVersion implementation="java.lang.String"
default-value="-v4.32.1">${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 98f6d297..cc38e19f 100644
--- a/project/Dependencies.scala
+++ b/project/Dependencies.scala
@@ -37,8 +37,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 = "3.25.9" // checked synced by VersionSyncCheckPlugin
- val googleProtobufJava = "3.25.9"
+ val googleProtoc = "4.32.1" // checked synced by VersionSyncCheckPlugin
+ val googleProtobufJava = "4.32.1"
val scalaTest = "3.2.20"
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 12b234b7..b76d0a63 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -42,4 +42,4 @@ libraryDependencies += "org.eclipse.jgit" %
"org.eclipse.jgit" % "5.13.5.2025082
// scripted testing
libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
-libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.20"
+libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" %
"1.0.0-alpha.4"
diff --git
a/sbt-plugin/src/sbt-test/gen-scala-server/10-scalapb-validate/build.sbt
b/sbt-plugin/src/sbt-test/gen-scala-server/10-scalapb-validate/build.sbt
index b25a3ab4..db91a847 100644
--- a/sbt-plugin/src/sbt-test/gen-scala-server/10-scalapb-validate/build.sbt
+++ b/sbt-plugin/src/sbt-test/gen-scala-server/10-scalapb-validate/build.sbt
@@ -12,6 +12,9 @@ import scalapb.GeneratorOption._
scalaVersion := "2.13.18"
+// ScalaPB Validate sbt plugin does not have a release that supports ScalaPB
1.0.0
+Global / evictionErrorLevel := Level.Info
+
enablePlugins(PekkoGrpcPlugin)
libraryDependencies +=
diff --git
a/sbt-plugin/src/sbt-test/gen-scala-server/10-scalapb-validate/project/plugins.sbt
b/sbt-plugin/src/sbt-test/gen-scala-server/10-scalapb-validate/project/plugins.sbt
index 8ee70630..c7a7d8c4 100644
---
a/sbt-plugin/src/sbt-test/gen-scala-server/10-scalapb-validate/project/plugins.sbt
+++
b/sbt-plugin/src/sbt-test/gen-scala-server/10-scalapb-validate/project/plugins.sbt
@@ -9,4 +9,7 @@
addSbtPlugin("org.apache.pekko" % "pekko-grpc-sbt-plugin" %
sys.props("project.version"))
+// ScalaPB Validate sbt plugin does not have a release that supports ScalaPB
1.0.0
+Global / evictionErrorLevel := Level.Info
+
libraryDependencies ++= Seq("com.thesamet.scalapb" %%
"scalapb-validate-codegen" % "0.3.6")
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]