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

build.mill files compiled by Scala 3 #3369

Open
wants to merge 54 commits into
base: main
Choose a base branch
from

Conversation

bishabosha
Copy link
Contributor

@bishabosha bishabosha commented Aug 13, 2024

This is work in progress to fix #3152

Numerous fixes were also needed to com-lihaoyi/mainargs, com-lihaoyi/sourcecode, and com-lihaoyi/mill-moduledefs

With the current state, only 1 example/integration tests is still failing:

  • integration.feature[plugin-classpath].local

known TODOs:

  • Discover macro
  • Applicative macro
  • Caller macro
  • Cross.Factory macro
  • EnclosingClass macro
  • Task macros
  • Cacher macro
  • Moduledefs compiler plugin (override inferrence)
  • All core Mill modules compile with Scala 3.5.0
  • Fix Zinc reporter patch linenumbers of build scripts
  • Check that bytecode analyzers work with Scala 3
  • cleanup library dependency conflicts
  • Support new Scala 3 syntax in build.sc files
  • Fix BSP reporter linenumbers for build scripts (Zinc reporter forwards to bsp)
  • Cleanup compiler warnings for outdated syntax

known incompatibilities:

  • can't use ExplicitResultTypes scalafix rule - need to upgrade mill-scalafix
  • Cross.scala uses the new quoted type syntax which scalafmt crashes on, (and version is frozen) so skip the file upgraded Scalafmt so not skipped anymore
  • skipping Mima currently due to 1000s of errors (perhaps we should generate filters?)
  • filtered one flaky test from example.thirdparty[mockito]
  • filtered out integration.feature[plugin-classpath] due to third party plugin dep

@lihaoyi
Copy link
Member

lihaoyi commented Aug 13, 2024

Thanks @bishabosha ! Lets get your mainargs changes landed, that way we can cut a release and you can test your WIP in CI

@lefou
Copy link
Member

lefou commented Aug 13, 2024

+1 for switching over to using directives!

@bishabosha
Copy link
Contributor Author

@bishabosha bishabosha force-pushed the scala3-build-sc branch 3 times, most recently from 9d1a986 to dc71022 Compare August 16, 2024 09:51
@bishabosha
Copy link
Contributor Author

bishabosha commented Aug 16, 2024

[Edit: after switching to depending on mainargs 0.7.2] in https://github.com/com-lihaoyi/mill/actions/runs/10418081276/job/28853542122?pr=3369 you can see integration tests like example/tasks/6-workers/local passing

@bishabosha
Copy link
Contributor Author

Rebased and included the new mill-moduledefs 0.11.0-M1

@bishabosha bishabosha force-pushed the scala3-build-sc branch 4 times, most recently from a06daca to 37ba541 Compare September 11, 2024 11:19
@bishabosha bishabosha force-pushed the scala3-build-sc branch 5 times, most recently from 917a024 to 78beea1 Compare September 17, 2024 18:59
@bishabosha
Copy link
Contributor Author

bishabosha commented Sep 18, 2024

@lihaoyi just recording here that the mockito third party test can be flaky (specifically StubbingLookupListenerCallbackTest.add_listeners_concurrently_sanity_check):

https://github.com/mockito/mockito/blob/1e337ed703ce2b78ce9ea40ff8b8c645f8219cf2/src/test/java/org/mockitousage/debugging/StubbingLookupListenerCallbackTest.java#L199-L202

as seen in the CI run https://github.com/com-lihaoyi/mill/actions/runs/10909315276/job/30277476457?pr=3369#step:9:4941

@bishabosha bishabosha force-pushed the scala3-build-sc branch 9 times, most recently from 022c789 to 368fec9 Compare September 20, 2024 23:18
@lihaoyi
Copy link
Member

lihaoyi commented Nov 26, 2024

merged in latest main and got most tests passing; there are still some stragglers but nothing blocking.

The main thing still missing is proper support for corrected line-numbers and file-names. This kinda-sorta works in certain cases and not others, e.g. sourcecode.Line and sourcecode.File gives the wrong values still

@bishabosha
Copy link
Contributor Author

bishabosha commented Nov 27, 2024

@lihaoyi maybe you can cherry-pick my plugin fixes from https://github.com/bishabosha/mill/tree/scala3-build-sc-reintroduce-linenumbers and https://github.com/bishabosha/mill/tree/scala3-build-sc-reintroduce-linenumbers-with-dotc-patch

From Scala 3.6.2 the backend will accept the line number fix from a plugin without needing hacks

Also I heard that the restriction on pre-typer plugins could potentially be lifted for non .scala files, if one were to make the PR to scala/scala3 - unsure if .sc still applies

@lihaoyi
Copy link
Member

lihaoyi commented Nov 27, 2024

All tests are green. Probably more polish to do esp.w.r.t. error locations, and will need a few more rebases, but hopefully not too many before we merge this in January

@lihaoyi lihaoyi added this to the 0.13.0 milestone Nov 27, 2024
@lihaoyi
Copy link
Member

lihaoyi commented Dec 18, 2024

Seems like some of the new ./mill -w 'integration.invalidation[codesig-subfolder].fork.test' mill.integration.CodeSigSubfolderTests.simple tests are failing on Scala 3. Probably just need to adjust some of the codesig heuristics we added in #4116 to be compatible with Scala 3

@lihaoyi
Copy link
Member

lihaoyi commented Dec 18, 2024

Seems like some lazy val initialization code in the <clinit> static initializer changes when you rename lazy vals in Scala 3

Screenshot 2024-12-18 at 10 00 30 PM

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.

Migrate build.sc to Scala 3
5 participants