Skip to content

Commit 63bf370

Browse files
committed
fix: gradle plugin was missing scalaPB generated files from library protos
1 parent 1d1d772 commit 63bf370

File tree

8 files changed

+15
-488
lines changed

8 files changed

+15
-488
lines changed

gradle-plugin/src/main/groovy/akka/grpc/gradle/AkkaGrpcPlugin.groovy

+5
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ class AkkaGrpcPlugin implements Plugin<Project> {
7373
// Play conventions:
7474
srcDir 'app/protobuf'
7575
srcDir 'app/proto'
76+
if (akkaGrpcExt.scala) {
77+
// TODO inject this into scalapb-protoc' option, also make sure generated scalapb proto file not depends on java proto file
78+
// library protos
79+
srcDir 'build/extracted-include-protos/main'
80+
}
7681
}
7782
}
7883
}

plugin-tester-scala/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def akkaHttpVersion = "10.6.0"
3939
dependencies {
4040
implementation group: 'ch.megard', name: "akka-http-cors_${scalaBinaryVersion}", version: '1.1.3'
4141
implementation "com.typesafe.akka:akka-pki_${scalaBinaryVersion}:${akkaVersion}"
42+
implementation "com.typesafe.akka:akka-actor-typed_${scalaBinaryVersion}:${akkaVersion}"
4243
testImplementation "com.typesafe.akka:akka-stream-testkit_${scalaBinaryVersion}:${akkaVersion}"
4344
testImplementation "com.typesafe.akka:akka-actor-testkit-typed_${scalaBinaryVersion}:${akkaVersion}"
4445
testImplementation "org.scalatest:scalatest_${scalaBinaryVersion}:3.2.12"

plugin-tester-scala/src/main/proto/shelf.proto

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
syntax = "proto3";
22

3+
//#import-external-proto-files
34
import "google/api/annotations.proto";
5+
//#import-external-proto-files
46

57
option java_multiple_files = true;
68
option java_package = "example.myapp.shelf.grpc";

plugin-tester-scala/src/test/scala/example/myapp/helloworld/ShelfServiceHttpTranscodingSpec.scala

+3
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ import akka.http.scaladsl.model.StatusCodes
1313
import akka.http.scaladsl.unmarshalling.Unmarshal
1414
import example.myapp.shelf.ShelfServer
1515
import example.myapp.shelf.grpc._
16+
import org.junit.runner.RunWith
1617
import org.scalatest.BeforeAndAfterAll
1718
import org.scalatest.wordspec.AnyWordSpecLike
19+
import org.scalatestplus.junit.JUnitRunner
1820
import spray.json.DefaultJsonProtocol._
1921
import spray.json._
2022

2123
import scala.concurrent.ExecutionContextExecutor
2224

25+
@RunWith(classOf[JUnitRunner])
2326
class ShelfServiceHttpTranscodingSpec
2427
extends ScalaTestWithActorTestKit(config = "akka.http.server.enable-http2 = on")
2528
with AnyWordSpecLike

project/Dependencies.scala

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ object Dependencies {
2323
val akkaHttpBinary = "10.6"
2424

2525
val grpc = "1.60.0" // checked synced by VersionSyncCheckPlugin
26+
val grpcGoogleProto = "2.22.0"
2627

2728
// Even referenced explicitly in the sbt-plugin's sbt-tests
2829
// If changing this, remember to update protoc plugin version to align in
@@ -108,13 +109,15 @@ object Dependencies {
108109
Compile.scalapbCompilerPlugin,
109110
Protobuf.protobufJava, // or else scalapb pulls older version in transitively
110111
Compile.grpcProtobuf,
112+
GrpcApi.googleApiProtos,
111113
Test.scalaTest)
112114

113115
val runtime = l ++= Seq(
114116
Compile.scalapbRuntime,
117+
Compile.scalapbRuntime % "protobuf",
115118
Protobuf.protobufJava, // or else scalapb pulls older version in transitively
116119
Protobuf.protobufJavaUtil,
117-
Protobuf.googleCommonProtos,
120+
GrpcApi.googleApiProtos.intransitive(),
118121
Compile.grpcProtobuf,
119122
Compile.grpcCore,
120123
Compile.grpcStub % "provided", // comes from the generators

runtime/src/main/protobuf/google/api/annotations.proto

-32
This file was deleted.

0 commit comments

Comments
 (0)