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

Ongoing Scala 3 migration effort #4079

Merged
merged 55 commits into from Nov 9, 2022
Merged

Ongoing Scala 3 migration effort #4079

merged 55 commits into from Nov 9, 2022

Conversation

jrudolph
Copy link
Member

@jrudolph jrudolph commented Mar 21, 2022

Projects can already use Akka HTTP with Scala 3 by using CrossVersion.for3Use2_13, but for libraries that is not a good solution. This PR is about providing 'native' Scala 3 artifacts for Akka HTTP.

Commits are supposed to stay, so let's try to use reasonable commits. Changes can be PR'd against this branch.

Here are some guidelines about what we want to achieve:

  • Scala 3 support for all modules
  • No significant code forks (version-dependent directories) of general purpose code. We can maintain some forks (e.g. in parsers if not possible otherwise) but in general we cannot maintain significant forks for Scala 3 compatibility. I.e. for now we need to find solutions that work for all of Scala 2.12, 2.13, and 3. If Scala 2.12 support is too big a burden, we might consider targeting Akka HTTP 10.3.0 where we might want to drop Scala 2.12 support (and Akka 2.5).
  • Only Akka 2.6 is supported, so I changed the default Akka version. Since we still build against Akka 2.5 by default we will have to find a solution for publishing the Scala 3 version against 2.6.
  • Please add a comment when working on a task item to avoid stepping on each other's toes.

Tasks:

For now start sbt with sbt -Dakka.build.akkaVersion=2.6.18 ++3.1.1 shell

… 3 easily

pre213 macro is broken and cannot be repaired. Maybe we'll need a simple compiler
plugin for Scala 3 to redo that functionality.
Up to c18fa929ebccf583f9d8d27a0c2588516ed75872
@jrudolph
Copy link
Member Author

If all parser sources are enabled, Scala 3 still gets into an unlimited loop. A relatively simple (though, nested) Parser that shows this behavior is IpAddressParsing.

@jchyb
Copy link
Contributor

jchyb commented Mar 28, 2022

Hello, I started working on the "Enable akka-http module for Scala 3 (currently disabled in Scala 3) and make main code compile" task, or at least as much as can be done without all of the akka-http-core parsers. Good luck everyone!

@jrudolph
Copy link
Member Author

Hello, I started working on the "Enable akka-http module for Scala 3 (currently disabled in Scala 3) and make main code compile" task, or at least as much as can be done without all of the akka-http-core parsers. Good luck everyone!

Great, thanks!

@prolativ
Copy link

I started working on the parsers. At least for now I have found out that that there's no infinite loop but the compilation time grows very quickly when a rule gets just slightly more complicated

@hughsimpson
Copy link
Contributor

hughsimpson commented Apr 7, 2022

I've been noodling around with akka-http-core and found that if there were more than two non-literal subrules in a parser chained with ~ it basically takes forever to compile, unless you force right-associativity with parentheses (i.e. `ip-number` ~ ('.' ~ (`ip-number` ~ ('.' ~ `ip-number`))) compiles fast enough, but `ip-number` ~ '.' ~ `ip-number` ~ '.' ~ `ip-number` basically takes forever). That trick allows pretty much all the rules to compile before one dies of old age, except for a couple of the top-level date parsers where it's still taking about 10 mins on my machine, and the UriParser stuff, which I didn't look at yet. Might be able to tidy up and pr some of that this week if all goes well. Not sure what the underlying cause for that slowdown is, though...

@lightbend-cla-validator

Hi @jrudolph, @raboof, @jchyb, @hughsimpson,

Thank you for your contribution! We really value the time you've taken to put this together.

We see that you have signed the Lightbend Contributors License Agreement before, however, the CLA has changed since you last signed it.
Please review the new CLA and sign it before we proceed with reviewing this pull request:

https://www.lightbend.com/contribute/cla

@lightbend-cla-validator

Hi @jrudolph, @raboof, @jchyb,

Thank you for your contribution! We really value the time you've taken to put this together.

We see that you have signed the Lightbend Contributors License Agreement before, however, the CLA has changed since you last signed it.
Please review the new CLA and sign it before we proceed with reviewing this pull request:

https://www.lightbend.com/contribute/cla

@mushtaq
Copy link

mushtaq commented Nov 8, 2022

@jrudolph Any way of trying out akka-http snapshot artifacts for scala-3?

@lightbend-cla-validator
Copy link

Hi @jrudolph, @raboof, @jchyb,

Thank you for your contribution! We really value the time you've taken to put this together.

We see that you have signed the Lightbend Contributors License Agreement before, however, the CLA has changed since you last signed it.
Please review the new CLA and sign it before we proceed with reviewing this pull request:

https://www.lightbend.com/contribute/cla

@johanandren
Copy link
Member

Not yet, for now you would have to build your own snapshot out of this branch.

@johanandren johanandren marked this pull request as ready for review November 8, 2022 13:53
@johanandren
Copy link
Member

Manually verified that jchyb has signed the CLA (and obviously jrudolph and raboof had since they were on the team)

The other failure is Fossa, ignoring that and merging.

@mkurz
Copy link
Contributor

mkurz commented Nov 9, 2022

Is there any chance this gets backported to 10.2.x?

@johanandren
Copy link
Member

No, we will only address critical security updates and critical bugs in the 10.2 series (as announced by Jonas here: https://discuss.lightbend.com/t/2-6-x-maintenance-proposal/9949/2 )

@johanandren johanandren merged commit 6277aa4 into main Nov 9, 2022
@johanandren johanandren deleted the scala-3 branch November 9, 2022 10:04
@mushtaq
Copy link

mushtaq commented Nov 9, 2022

@johanandren I remember that there used to be a maven repository containing akka nightly build jars. Google is not helping me right now, but I have used that once in the past.

@raboof
Copy link
Member

raboof commented Nov 9, 2022

I remember that there used to be a maven repository containing akka nightly build jars. Google is not helping me right now, but I have used that once in the past.

Those are at https://oss.sonatype.org/content/repositories/snapshots/com/typesafe/akka/ (further documented at https://doc.akka.io/docs/akka-http/current/contributing.html#snapshots)

@mushtaq
Copy link

mushtaq commented Nov 9, 2022

thanks @raboof !

@johanandren johanandren added this to the 10.5.0-M1 milestone Nov 10, 2022
@johanandren
Copy link
Member

@mushtaq now out in a first milestone release on maven central 10.5.0-M1

@mushtaq
Copy link

mushtaq commented Nov 11, 2022

@mushtaq now out in a first milestone release on maven central 10.5.0-M1

Awesome, thank you!

@mushtaq
Copy link

mushtaq commented Nov 17, 2022

@johanandren I tried the milestone, but this single crashed the compiler!

$ echo demo.sc
//> using scala "3.2.1"
//> using lib "com.typesafe.akka::akka-http:10.5.0-M1"

println(akka.http.scaladsl.model.HttpEntity)

$ scala-cli compile demo.sc
Compiling project (Scala 3.2.1, JVM)
exception occurred while compiling /Users/mushtaqahmed/projects/scala3/scripts/.scala-build/project_0676cca331-7fb9ff8688/src_generated/main/akka-http-compiler-crash.scala
Error compiling project (Scala 3.2.1, JVM)
Error: Unexpected error when compiling project_0676cca331-7fb9ff8688: 'assertion failed'
Compilation failed

Should I open an issue?

@johanandren
Copy link
Member

Please do, it's nothing we were aware of.

@mushtaq
Copy link

mushtaq commented Nov 17, 2022

Done #4194

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

Successfully merging this pull request may close these issues.

None yet