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

Cross-build to Scala 2.13 #40

Closed
2 tasks done
dwijnand opened this issue Feb 1, 2019 · 20 comments
Closed
2 tasks done

Cross-build to Scala 2.13 #40

dwijnand opened this issue Feb 1, 2019 · 20 comments

Comments

@dwijnand
Copy link
Member

dwijnand commented Feb 1, 2019

Direct upstream blockers:

@dwijnand
Copy link
Member Author

akka-grpc 0.6.0+11-23237fc2 supports Scala 2.13.0-M5

@dwijnand
Copy link
Member Author

dwijnand commented Mar 26, 2019

blocked on lagom/lagom#1240

partial progress made in #79.

@sigurdthor
Copy link

Hi! Any progress in 2.13 support for play-grpc?

@matankdr
Copy link

Hi, any updates would be much appreciated :)

@raboof
Copy link
Member

raboof commented Mar 18, 2020

play-grpc is now on lagom 1.6.0 which supports Scala 2.13, so that requirement is fulfilled.

I think the way forward would be to start with master and adding cross-building there, perhaps taking inspiration from #79 (which is from a while back).

Would you be interested in giving it a try?

@matankdr
Copy link

@raboof , thanks for your (very!) fast reply. I started working on that (was able to migrate play-grpc-generators to Scala 2.13).
However, to the best of my knowledge, it seems like all play-grpc and akka-grpc sub-projects need to be migrated to Scala 2.13 and have the same version.
Is it true?

@raboof
Copy link
Member

raboof commented Mar 20, 2020

@matankdr play-grpc consists of code generation utilities and a runtime library.

Since the code generation is done in the build tool (typically sbt, which is on Scala 2.12), I think the code generation code itself doesn't need to be ported to 2.13 yet. To use play-grpc in a Scala 2.13 project, we have to make sure the generated code is 2.13-compatible (I think it probably is, or perhaps only needs minor changes) and make sure the runtime library is available on 2.13.

This is similar to the Akka gRPC project: most resources are built only for Scala 2.12 (e.g. https://github.com/akka/akka-grpc/blob/master/build.sbt#L102), but the runtime library is built for both 2.12 and 2.13 (https://github.com/akka/akka-grpc/blob/master/project/Common.scala#L72).

Great that you are interested in having a look at this! Feel free to let us know if you have anything in-progress, even if unfinished. Setting up cross-building in sbt can be a challenge sometimes...

@Tochemey
Copy link

@raboof is it not just to add these lines of code and publish because I have seen you made the necessary update to akka grpc and scalapb:

lazy val scala212 = "2.12.10"
lazy val scala213 = "2.13.1"
lazy val supportedScalaVersions = List(scala212, scala213)
val playRuntime = Project("play-grpc-runtime", file("play-runtime"))
  .settings(
    libraryDependencies ++= Seq(
      Dependencies.Compile.akkaGrpcRuntime,
      Dependencies.Compile.play,
      Dependencies.Compile.playAkkaHttpServer,
      Dependencies.Compile.akkaDiscovery,
    ),
   crossScalaVersions := supportedScalaVersions,
  )

val playGenerators = Project("play-grpc-generators", file("play-generators"))
  .enablePlugins(SbtTwirl, BuildInfoPlugin)
  .settings(
    libraryDependencies ++= Seq(
      Dependencies.Compile.akkaGrpcCodegen,
      Dependencies.Test.scalaTest,
    ),
     crossScalaVersions := supportedScalaVersions,
  )

@raboof
Copy link
Member

raboof commented Mar 22, 2020

@Tochemey that looks like a good start! play-grpc-generators might not need 2.12 (since that is only used during code generation). Have you tested that yet? sbt can be a bit picky with cross-building, so you might need some more of the changes in #79.

@Tochemey
Copy link

@raboof When I tried this #40 (comment) I got the following error message:

Issuing a cross building command, but not all sub projects have the same cross build configuration. This could result in subprojects cross building against Scala versions that they are not compatible with. Try issuing cross building command with tasks instead, since sbt will be able to ensure that cross building is only done using configured project and Scala version combinations that are configured.
[info] Reapplying settings...

Forgive me I am still finding my feet with sbt.

raboof added a commit to raboof/play-grpc that referenced this issue Mar 30, 2020
@Tochemey
Copy link

Tochemey commented Mar 30, 2020

@raboof In the travis file in your PR don't you think we need to add this line for the scala 2.13

scala:
  - 2.12.8
  - 2.13.1

@Tochemey
Copy link

@raboof Also when I pullded it and cross compile it locally I got this error:

[error] /Users/arsene/dev/scala-projects/play-grpc/play-testkit/src/main/java/play/grpc/testkit/JavaAkkaGrpcClientHelpers.java:50:1: incompatible types: scala.collection.Traversable<play.core.server.ServerEndpoint> cannot be converted to scala.collection.Iterable<play.core.server.ServerEndpoint>
[error] possibleEndpoints.filter(endpoint -> endpoint.ssl().isDefined())

@raboof
Copy link
Member

raboof commented Mar 30, 2020

In the travis file in your PR don't you think we need to add this line for the scala 2.13

That could be a nice improvement in this case indeed, though now it already tests 2.13 with '++'

when I pullded it and cross compile it locally I got this error

Ah, good one, I broke 2.12 while fixing 2.13 ;). Should be OK for both now.

@Tochemey
Copy link

Tochemey commented Mar 30, 2020

@raboof The build is ok now. Is there a way for me to access the snapshot and tried it on my project while waiting for the official release?

@raboof
Copy link
Member

raboof commented Mar 30, 2020

We don't currently publish snapshots, but if you 'publishLocal' you might be able to build some for yourself?

@Tochemey
Copy link

@raboof Yeah I tried run this:

sbt ++2.12.8 publishLocal ++2.13.1 publishLocal

However I am getting some javadocs errors:

 Unexpected javac output: javadoc: error - invalid flag: --ignore-source-errors.
[error] sbt.inc.Doc$JavadocGenerationFailed
[error] 	at sbt.inc.Doc$$anon$1.run(Doc.scala:72)
[error] 	at sbt.inc.Doc$$anon$2.run(Doc.scala:91)
[error] 	at sbt.inc.Doc$$anon$3.$anonfun$run$5(Doc.scala:118)
[error] 	at sbt.inc.Doc$$anon$3.$anonfun$run$5$adapted(Doc.scala:114)
[error] 	at sbt.util.Tracked$.$anonfun$inputChanged$1(Tracked.scala:150)
[error] 	at sbt.inc.Doc$$anon$3.run(Doc.scala:122)
[error] 	at sbt.Defaults$.$anonfun$docTaskSettings$3(Defaults.scala:1643)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:67)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:281)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
[error] 	at sbt.Execute.work(Execute.scala:290)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:281)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:748)
[error] (lagom-javadsl-grpc-testkit / Compile / doc) sbt.inc.Doc$JavadocGenerationFailed

@raboof
Copy link
Member

raboof commented Mar 30, 2020

invalid flag: --ignore-source-errors

Ah, that flag is only available on jdk11 - and in retrospect should not be needed. Can you try again?

@Tochemey
Copy link

@raboof It did work like magic. So I will fork your branch and push it onto our private artifactory. So when you guys officialy release it then I will just switch.

@Tochemey
Copy link

@raboof Quick one I think we can also silence some of the unused import message of sbt

octonato pushed a commit that referenced this issue Mar 31, 2020
* Cross-build to Scala 2.13 #40

* formatting

* Fix JavaAkkaGrpcClientHelpers on 2.12

* --ignore-source-errors not needed after all

and is jdk11-only
@octonato octonato added this to the 0.7.2 milestone Mar 31, 2020
@octonato
Copy link
Contributor

Resolved in #228

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

No branches or pull requests

6 participants