Open marcesquerra opened 3 years ago
It may not be trivial, but any help is appreciated!
What I would do:
Let me know if you get stuck or need help on any of the steps.
I started looking into this and I got it to the point where I can at least compile & run a hello world https://github.com/cocreature/rules_scala/tree/scala-3. The next big missing piece is probably the dependency analyzer. I’m also largely ignoring backwards compatibility for now since I first want to get it to work before I worry about that too much. The compiler API is completely different so some parts will just consist of duplicating the code. Happy to share the work, the time I can spend on this atm is relatively limited.
@cocreature would you be still interested contributing your work? I experimented on your changes, you can see how to make them Scala 2.x compatible: https://github.com/liucijus/rules_scala/tree/scala3-in-progress
Unfortunately I got stuck trying to port the custom scala code for the unused deps & similar to Scala 3 so while it worked for a hello world, I couldn’t actually get it to work on our full project. I don’t expect keeping compatbiility with Scala 2 at the end will be the challenging part.
I don’t have the time at the moment to debug this further so if someone else wants to pick it up, by all means go for it. If not, I expect I’ll eventually get back to it but no idea about timelines.
@cocreature I'm planning to work on Scala 3 support, and got it working to some extent based on your changes though I had to do some modifications to select code based on Scala version. I thought it would be great to get you attributed for your initial development (ScalaWorker, Scala 3 deps, etc). Of course I can just start from scratch and open PR myself as I did in my fork. But it's up to you to decide. The only requirement is to make the Scala 2 compatible, Scala 3 code can be untested, I will take over from there. Let me know what you think.
Appreciate it but I’m perfectly happy to not be acknowledged here so just go ahead and open a PR yourself.
Reopening as it was closed unintentionally
I'd be glad to help with this issue. I just opened #1408 for an issue I was facing with Scala3.
Has anyone created an inventory of what needs to be completed to declare victory on Scala3 compatibility? Are there Scala3 features that are not supported, yet?
I imagine at the very least, we'd want to be able to compile code and add CI to ensure that something using Scala 3 LTS (currently 3.3.4) can compile safely. And, there is some interplay between Scala 3 and 2.13 libraries for compatibility reasons, so we'll want to ensure that anything compiled using those flags doesn't break. Most adopters will be straddling for a while.
Though, now that I've said that, it looks like that's what test_crossbuild does.
Should one of us go through the list of open issues tagged with Scala 3 as a start?
I just checked. There are no open issues tagged with scala3. I did find two other issues besides this one that mention Scala3.
I pinged this thread, because I saw a scala3 example in the repo and I saw this open issue. I am mostly trying to understand what we think is missing. If anyone is using this ruleset with scala3 code, I would love to hear about it.
I'd say that Scala native is nice to have, not a requirement for Scala3 compatibility of this rule set.
Edit - looks like the cats issue was just transitive dependencies.
If we feel like test_crossbuild
has minimal compatibility with Scala 3.3.4, supports the varying crossbuild flags for 2.13/3, supports usage of 2.13 libraries for Scala 3 (like sbt does with for3Use2_13
), and compiles valid Java bytecode - we're probably fine to declare victory. That's my vote.
Now that scala 3 is officially live, how difficult would it be to add support for it in bazel?
If it's just a matter of adding a custom toolchain, a bit of documentation would help (I tried to do it in a sample project but couldn't manage)
UPDATE: I initially said I could give a shot on trying to move this forward, but I have to back down. Both the scope of this and the demands of real life ended up being bigger than I thought. But still, support for Scala 3 would still be great!