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 68 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 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

@lihaoyi
Copy link
Member

lihaoyi commented Dec 20, 2024

Seems like the Scala 3.6.2 upgrade is causing new issues, may be worth punting on that for now and just getting onto 3.5.x first

@lihaoyi
Copy link
Member

lihaoyi commented Dec 20, 2024

Somehow it is this line that is causing the bootstrap compile to hang

--- a/main/codesig/src/ReachabilityAnalysis.scala
+++ b/main/codesig/src/ReachabilityAnalysis.scala
@@ -91,7 +91,7 @@ class CallGraphAnalysis(
     case None => ujson.Obj()
   }
 
-  logger.mandatoryLog(spanningInvalidationTree)
+  //logger.mandatoryLog(spanningInvalidationTree)
 }
 

@lihaoyi
Copy link
Member

lihaoyi commented Dec 20, 2024

Looks like bootstrapping on Scala 3.6.2 works again after optimizing def breadthFirst a bit. Not sure why it wasn't causing problems before, and why it started causing problems now, but optimizing the queue management in the BFS seems to unblock most of the CI jobs

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