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

Support scala 3 #480

Closed
mushtaq opened this issue Nov 13, 2021 · 15 comments
Closed

Support scala 3 #480

mushtaq opened this issue Nov 13, 2021 · 15 comments

Comments

@mushtaq
Copy link
Contributor

mushtaq commented Nov 13, 2021

I think this mainly applies to the derivation module because macros will need to be rewritten.

@sirthias
Copy link
Owner

Thank you, @mushtaq!
I am on that.
With low prio at this point but the migration to Scala 3 is on my radar.

@martinring
Copy link

Hey @sirthias, would you accept any help with the scala 3 migration? I'd love to get involved.

@sirthias
Copy link
Owner

sirthias commented Jan 8, 2022

Hey Martin,
thanks for raising your hand!
I'm feeling the pressure on this ticket myself, but have so far refrained from diving in head first in order to not throw my new years resolution "focus more on the actual important in your life" right out of the window in the first days of January... :)

I've already played around with Scala 3 support sometime last year and managed to get cross-building across 2.12, 2.13 and 3 set up and working fine for all modules except derivation.

As the derivation logic is somewhat involved and produces quite optimized code the macros aren't the easiest to migrate. If you want to jump in, I'd be happy to look at PRs and help where I can.

One thing that might help a great deal is https://github.com/sirthias/macrolizer.
Maybe we should first release that for Scala 3 in order to help with development and debugging?

@plokhotnyuk
Copy link
Contributor

Hey Mathias,

Here is a great example of derivation macros migration from Scala 2 to Scala 3.

All credits to @rssh - he made it source compatible between Scala 2 and 3 versions to be tested by the same test sources except special cases for new enums.

@sirthias
Copy link
Owner

Thank you, @plokhotnyuk!
I'll take a look at it.
I'm currently planning on starting with the port to Scala 3 later this month, although I probably won't go for a cross-compiling setup.
I'll simply bump the version number and make a full jump to Scala 3...

@mushtaq
Copy link
Contributor Author

mushtaq commented Feb 17, 2022

@sirthias Came across this note in Scala 3.1.1 release:

Dual Scala 2/3 macros can be now declared in non-experimental scopes (PR #13795).

But as a user of this lib, I am ok if you want to release say borer-2.0.0 only for Scala-3.
I do not see any issue in keep using 1.7.2 version for those who remain on Scala 2.13.

@OndrejSpanel
Copy link
Contributor

I am interested in Scala 3 version, as Borer is one of the last few major dependencies blocking my project from upgrading.

Is there anything I could do to help this happen (work on some issues, sponsoring...)?

@sirthias
Copy link
Owner

sirthias commented May 28, 2022

@OndrejSpanel We are in the same position as you, with borer being the last dependency holding us back from the Scala 3 upgrade.
So, I've been investing a few hours last week to make it happen and made good progress.
There is only one last thing missing in the derivation macro work but I expect to be able to cut at least an initial Scala 3 version until Friday.
Which modules are you depending on?
Only core and derivation, I assume?

@OndrejSpanel
Copy link
Contributor

Exactly, core and derivation.

That is really great news.

If there is some way I could help, please let me know. Otherwise I stay looking forward to the version.

@sirthias
Copy link
Owner

sirthias commented Jun 3, 2022

Ok, quick status update:
ArrayBasedCodecs are passing all tests and MapBasedCodecs are completely implemented.
I'm in the process of enabling all tests, one by one, cleaning up, etc.
However, I have to stop right now because I'm about to take off to a two week family vacation.
So, unfortunately, no release yet.

But, there is not much missing, maybe two or three hours more before a first release for Scala 3.
All obstacles have been surmounted, there are no showstoppers left.
(But due to the complexities of the borer macros this migration wasn't the easiest of tasks... :-/)

I've pushed my current state to the scala-3 branch, if anyone wants to take a look.
(I'm currently in the middle of moving the tests in the derivation3 module from uTest to mUnit, they aren't compiling right now...)

I'll finish this all up when I get back in two weeks and will definitely publish a release then.
Cheers!

@OndrejSpanel
Copy link
Contributor

Great news. Thanks for letting us know on the progress, so that we can tune our migration plans accordingly.

Enjoy your holiday.

@sirthias
Copy link
Owner

Another update. The Scala 3 macros are finally done.
Everything is implemented and all tests are passing.
It took a while longer, as always, also due to more compiler bugs that I had to work around.

Now the only thing missing is packaging and releasing, which I hope I'll be able to complete on Monday.

@sirthias
Copy link
Owner

sirthias commented Jul 8, 2022

Got held back by real world priorities but did not forget this ticket... :)
I just pushed a couple more commits separating the scala2 build into its own branch.
From now on the master will be scala 3 only.

Now aiming for Tuesday as release day for the the scala 3 artifacts.
I'm sorry for the constant delays but I guess you know how it is...

@mushtaq
Copy link
Contributor Author

mushtaq commented Jul 9, 2022

Hey @sirthias I so much appreciate you regularly updating the progress on this ticket!

Even though my current work does not involve migrating to Scala3, I am keenly reading these and feel really excited 🎉

Thank you so much for all your work.

@sirthias
Copy link
Owner

And it's finally done!
I just published borer 1.10.0 to sonatype. Should appear on Maven Central shortly.
1.10.0 is Scala-3-only. The latest version for Scala 2.13 is 1.8.0.
Thank you for sticking with me this long.
This migration really was quite some work and I'm glad to finally get it out the door.
I've refrained from changing to API too much from the previous version to make the upgrade easier.
Scala 3 gives us quite a few more options with regard to API design that I might pursue at some point in the future.
So far the idea was simply to get something released that gets the job done...

Please report any issues you find!

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