Closed Christewart closed 1 month ago
We still support scala 2.12 so we will not be making scala3 style source the default. If someone finds a way to make this configurable - then we can go that route.
We still support scala 2.12 so we will not be making scala3 style source the default. If someone finds a way to make this configurable - then we can go that route.
I think in my case, its literally just adding type annotations to the generated scala code
The non compliant -Xsource:3
code
//does not compile with `-Xsource:3`
lazy val values = scala.collection.immutable.Seq(LEGACY, ANCHOR)
what -quickfix:any
rewrites it to
//compiles with -Xsource:3 because `values` has the type annotation
lazy val values: Seq[wtclientrpc.PolicyType.Recognized] = scala.collection.immutable.Seq(LEGACY, ANCHOR)
Now if I re-compile, removing the -quickfix:any
compiler flag, I revert back to the first version with no type annotation on values
I know collections were redone in 2.13.x
, does this mean this can't safely be done while still supporting 2.12.x
?
@Christewart this is a volunteer project. Noone works full time on it. If you would like to try a solution, we will review any PRs.
pekko-grpc codegen is built on top of https://github.com/scalapb/ScalaPB and it is ScalaPB that generates the source for the lazy val values
as far as I can see.
ScalaPB recently added https://github.com/scalapb/ScalaPB/commit/83b849f59764f527c2ecda4905e4e48d75bbb4b2
In the next few weeks, we should be releasing a 1.1.0-M1 version of pekko-grpc that uses the latest ScalaPB release
closing - as we already have https://github.com/apache/pekko-grpc/pull/222
https://pekko.apache.org/docs/pekko-grpc/current/buildtools/sbt.html#generating-server-
With Pekko-GRPC 1.1 snapshots or releases, you should be able to add this to your sbt file.
pekkoGrpcCodeGeneratorSettings += "scala3_sources"
I'm attempting to update my grpc project to use the
-Xsource:3
https://docs.scala-lang.org/scala3/guides/migration/tooling-scala2-xsource3.html
I can use
-quickfix:any
to re-write the generated scala code, however if I don't constantly keep-quickfix:any
in thescalacOptions
, the code will revert back to the non compliant-Xsource:3
after aclean
In bitcoin-s, the project that uses grpc is
lndRpc
. You can reproduce this by runninglndRpc/compile
https://github.com/bitcoin-s/bitcoin-s/pull/5595
You can see the failures on CI here: https://github.com/bitcoin-s/bitcoin-s/actions/runs/9097285380/job/25004754803