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

Scala 3 support #260

Closed
kubukoz opened this issue Mar 24, 2021 · 13 comments
Closed

Scala 3 support #260

kubukoz opened this issue Mar 24, 2021 · 13 comments

Comments

@kubukoz
Copy link
Contributor

kubukoz commented Mar 24, 2021

Is decline going to support Scala 3 in the future? Are there any blockers, macros to migrate etc. or would it be mostly a build setup change?

@bkirwi
Copy link
Owner

bkirwi commented Apr 17, 2021

I'd certainly hope to support Scala 3, and I don't foresee any blockers... we don't use any macros or esoteric language features. That said, I don't think anyone's tried it yet!

@keynmol
Copy link
Contributor

keynmol commented Apr 20, 2021

The actual set of code changes is very small: #273

There's some small build shenanigans to solve, but my Travis-fu and ++ style compilation is limited :) I can convert it to sbt-projectmatrix but that'd be a poor move just for scala 3 support :D

@bkirwi
Copy link
Owner

bkirwi commented May 13, 2021

I'm currently looking at updating the build based on @keynmol's linked PR, now that the 3.0 release is out!

I'd consider releasing even if refined and enumeratum don't have support yet, and just not building those for 3.0... they're not nearly as heavily used as core. But we'll see how it goes.

@antonkulaga
Copy link

Also, waiting for this

@bkirwi
Copy link
Owner

bkirwi commented May 30, 2021

Currently enumeratum is the only blocker, and that project appears unlikely to get Scala 3 support anytime soon from what I can tell.

I've spent a long and irritating time trying to get TravisCI excluding the enumeratum build only on Scala 3. Unless someone wants to volunteer to get that working, I'm likely to drop that module from the release and get that out within the next few days. (The enumeratum integration is ~trivial, and I suspect the cost of holding up Scala 3 support is much higher than the cost to the small number of users of that integration who won't be able to use the latest decline, especially since this project is very stable.)

@antonkulaga
Copy link

I have a feeling that Scala 3 made it redundant

@dfurmans
Copy link

So the easy way to perform the upgrade will be
Before all change Scala version to 2.13
0. Check all libs for all modules

lazy val declineJVM = decline.jvm

[info] "org.typelevel" %% "cats-laws" % "2.6.1" % "test"            -> Valid 
[info] "org.typelevel" %% "cats-core" % "2.6.1"                     -> Valid 
[info] "org.typelevel" %% "discipline-scalatest" % "2.1.5" % "test" -> Valid 
[info] org.typelevel:kind-projector:0.13.0:plugin->default(compile) -> -Ykind-projector : This compiler plugin has a scalacOption equivalent. Add it to your scalacOptions.
lazy val declineJS = decline.js

[info] "org.typelevel" %%% "cats-laws" % "2.6.1" % "test"            -> Valid 
[info] "io.github.cquiroz" %%% "scala-java-time" % "2.3.0"           -> Valid 
[info] "org.typelevel" %%% "cats-core" % "2.6.1"                     -> Valid 
[info] "org.typelevel" %%% "discipline-scalatest" % "2.1.5" % "test" -> Valid 
[info] org.typelevel:kind-projector:0.13.0:plugin->default(compile)  -> -Ykind-projector : This compiler plugin has a scalacOption equivalent. Add it to your scalacOptions.
[success] Total time: 0 s, completed 12 cze 2021, 01:43:26
lazy val bench = bench
[info] "org.openjdk.jmh" % "jmh-core" % "1.25"                 -> Valid : Java libraries are compatible.
[info] "org.openjdk.jmh" % "jmh-generator-bytecode" % "1.25"   -> Valid : Java libraries are compatible.
[info] "org.openjdk.jmh" % "jmh-generator-reflection" % "1.25" -> Valid : Java libraries are compatible.
[success] Total time: 0 s, completed 12 cze 2021, 01:43:45
lazy val refinedJVM = refined.jvm
[info] "eu.timepit" %% "refined" % "0.9.25"                     -> Valid : Other versions are avaialble for Scala 3: "0.9.26"
[info] "eu.timepit" %% "refined-scalacheck" % "0.9.25" % "test" -> Valid : Other versions are avaialble for Scala 3: "0.9.26"
[success] Total time: 0 s, completed 12 cze 2021, 01:44:09
lazy val refinedJS = refined.js
[info] "eu.timepit" %%% "refined-scalacheck" % "0.9.25" % "test" -> Valid : Other versions are avaialble for Scala 3: "0.9.26"
[info] "eu.timepit" %%% "refined" % "0.9.25"                     -> Valid : Other versions are avaialble for Scala 3: "0.9.26"
lazy val effectJVM = effect.jvm
[info] "org.typelevel" %% "cats-effect" % "3.1.1" -> Valid 
lazy val effectJS = effect.js
[info] "org.typelevel" %%% "cats-effect" % "3.1.1" -> Valid 
lazy val enumeratumJVM = enumeratum.jvm
[info] com.beachape:enumeratum:1.6.1 -> "com.beachape" %% "enumeratum" % "1.6.1" cross CrossVersion.for3Use2_13 : It's only safe to use the 2.13 version if it's inside an application.
lazy val enumeratumJS = enumeratum.js
[info] com.beachape:enumeratum:1.6.1 -> "com.beachape" %%% "enumeratum" % "1.6.1" cross CrossVersion.for3Use2_13 : It's only safe to use the 2.13 version if it's inside an application.
lazy val doc = doc
[info] org.scalameta:mdoc:2.2.20 -> "org.scalameta" %% "mdoc" % "2.2.21" 
  1. Check all scala compiler options
    Wrong compiler options for Scala 3
root
[info] In configuration Compile:
[info] -Yrangepos -> X

[info] 
[info] In configuration Test:
[info] -Yrangepos -> X

  1. Check if we have any kind of marcos in Scala 2.x way

For that quick check I have used amazing sbt scala3-migrate plugin
https://github.com/scalacenter/scala3-migrate

Summary:
=> The main dependency issue for bringing the Scala 3 :
[info] com.beachape:enumeratum:1.6.1 -> "com.beachape" %%% "enumeratum" % "1.6.1" cross CrossVersion.for3Use2_13 : It's only safe to use the 2.13 version if it's inside an application.
=> Compiler options for each module
=> Any Macros ???

@kubukoz
Copy link
Contributor Author

kubukoz commented Jun 12, 2021

Note that there's some progress in #293

@bkirwi
Copy link
Owner

bkirwi commented Jul 3, 2021

Apologies for the lag on this!

Since we haven't seen anyone step up to take on the enumeratum support, I'm cutting a build that drops it as part of the Scala 3 upgrade. Will have that out this weekend.

@bkirwi
Copy link
Owner

bkirwi commented Jul 3, 2021

Alright, enumeratum support is dropped, and Scala 3 is supported as of version 2.1.0. Let me know if you run into any issues!

If anyone stumbles on this because they're missing the enumeratum support:
a) Sorry!
b) I'm open to PRs that restore the module as long as they don't significantly affect the complexity of the build / CI / release process. However, you may want to contribute the code to enumeratum instead... they already have quite a few contrib modules, so the code should fit in there, and we'd avoid any Scala-version-related build hassles.

@kubukoz
Copy link
Contributor Author

kubukoz commented Jul 4, 2021

@bkirwi I can't see the release on maven central :( nothing with the _3 suffix in https://repo1.maven.org/maven2/com/monovore/ at this moment

edit: tagged the wrong person, sorry 😂

@kubukoz
Copy link
Contributor Author

kubukoz commented Jul 5, 2021

I see it now :D

@kubukoz kubukoz closed this as completed Jul 5, 2021
@bkirwi
Copy link
Owner

bkirwi commented Jul 5, 2021

Yeah, looks like something got wedged in the Sonatype release process... thanks for flagging! Looks good on my end now as well.

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

5 participants