Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlayGrpc code generation error #215

Closed
Tochemey opened this issue Feb 20, 2020 · 4 comments
Closed

PlayGrpc code generation error #215

Tochemey opened this issue Feb 20, 2020 · 4 comments

Comments

@Tochemey
Copy link

I am facing an issue while generating scala classes using PlayGrpc.
I am using:

Scala Version: 2.13.1
sbt version: 1.3.8
lagom version : 1.6

These are my settings:

.settings(
    inConfig(Compile)(
      Seq(
        PB.protoSources := Seq(file("account/src/main/protobuf")),
        PB.includePaths ++= Seq(file("account/src/main/protobuf")),
      )
    ),
    // Using Scala
    akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Scala),
    akkaGrpcGeneratedSources := Seq(AkkaGrpc.Server, AkkaGrpc.Client),
    akkaGrpcExtraGenerators in Compile += PlayScalaServerCodeGenerator,
    akkaGrpcCodeGeneratorSettings += "server_power_apis"
  )

and this is the error I am having:

[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractAccountGrpcServicePowerApiRouter.scala:11:13: object grpc is not a member of package play
[error] import play.grpc.internal.PlayRouter
[error]             ^
[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractAccountGrpcServicePowerApiRouter.scala:19:13: not found: type PlayRouter
[error]     extends PlayRouter(AccountGrpcService.name)
[error]             ^
[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractAccountGrpcServicePowerApiRouter.scala:19:43: no arguments allowed for nullary constructor Object: ()Object
[error]     extends PlayRouter(AccountGrpcService.name)
[error]                                           ^
[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractAccountGrpcServicePowerApiRouter.scala:5:25: Unused import
[error] import scala.concurrent.Future
[error]                         ^
[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractAccountGrpcServicePowerApiRouter.scala:7:35: Unused import
[error] import akka.http.scaladsl.model.{ HttpRequest, HttpResponse }
[error]                                   ^
[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractAccountGrpcServicePowerApiRouter.scala:7:48: Unused import
[error] import akka.http.scaladsl.model.{ HttpRequest, HttpResponse }
[error]                                                ^
[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractAccountGrpcServicePowerApiRouter.scala:11:27: Unused import
[error] import play.grpc.internal.PlayRouter
[error]                           ^
[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractRouter.scala:11:13: object grpc is not a member of package play
[error] import play.grpc.internal.PlayRouter
[error]             ^
[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractRouter.scala:19:13: not found: type PlayRouter
[error]     extends PlayRouter(AccountGrpcService.name)
[error]             ^
[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractRouter.scala:19:43: no arguments allowed for nullary constructor Object: ()Object
[error]     extends PlayRouter(AccountGrpcService.name)
[error]                                           ^
[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractRouter.scala:5:25: Unused import
[error] import scala.concurrent.Future
[error]                         ^
[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractRouter.scala:7:35: Unused import
[error] import akka.http.scaladsl.model.{ HttpRequest, HttpResponse }
[error]                                   ^
[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractRouter.scala:7:48: Unused import
[error] import akka.http.scaladsl.model.{ HttpRequest, HttpResponse }
[error]                                                ^
[error] /Users/arsene/dev/accounts-service/account/target/scala-2.13/src_managed/main/com/namely/account/AbstractRouter.scala:11:27: Unused import
[error] import play.grpc.internal.PlayRouter
[error]                           ^
[error] 14 errors found
[error] (account / Compile / compileIncremental) Compilation failed

Amazingly when I checked the classes are generated. But whenever I run sbt compile I got that error.

@Tochemey
Copy link
Author

The issue I am having is that play-grpc-runtime is not available on scala 2.13

@raboof
Copy link
Member

raboof commented Feb 25, 2020

That makes sense! Would you be interested in contributing cross-building for 2.13?

@Tochemey
Copy link
Author

Tochemey commented Mar 21, 2020

@raboof I observe that the akka-grpc codegen is still 2.12. I did some test locally and I got stuck.
https://github.com/akka/akka-grpc/blob/master/build.sbt#L35

@raboof
Copy link
Member

raboof commented Mar 22, 2020

@Tochemey that's correct - but AFAICS that should not be a problem, since 'codegen' is only used during code generation (so 'inside' sbt, which is on scala 2.12) - you already noticed the classes are generated, it's just the runtime library that needs to be made available for 2.12.

Perhaps we should merge this issue with #40? Let's continue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants