-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[sbt-bridge] Bump Zinc to 1.4.3 and upgrade to CompilerInterface2 #10607
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
Conversation
6973f0f
to
c6fa4c6
Compare
sbt-bridge/resources/META-INF/services/xsbti.compile.CompilerInterface2
Outdated
Show resolved
Hide resolved
bad60ff
to
528d3b6
Compare
def getSource(path: String): SourceFile = getSource(path.toTermName) | ||
|
||
/** AbstraFile with given path name, memoized */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the memoization needed here? Does the Scala 2 compiler bridge do something similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following our private discussion I try to remove sourceNamed
in b492fd8
@@ -489,7 +490,7 @@ object Build { | |||
// get libraries onboard | |||
libraryDependencies ++= Seq( | |||
"org.scala-lang.modules" % "scala-asm" % "7.3.1-scala-1", // used by the backend | |||
Dependencies.`compiler-interface`, | |||
Dependencies.oldCompilerInterface, // we stick to the old version to avoid deprecation warnings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the plan for removing these warnings? Should we open an issue to keep track of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan is to upgrade the version of Zinc in Mill. Then use the new Zinc API in the compiler. I have a branch with those changes in my fork that has passed the CI, except for Mill community projects.
I'll open an issue as soon as this is merged.
@@ -521,15 +526,34 @@ object DottyPlugin extends AutoPlugin { | |||
scalaLibraryJar, | |||
dottyLibraryJar, | |||
compilerJar, | |||
allJars | |||
allJars, | |||
appConfiguration.value | |||
) | |||
} | |||
|
|||
// Adapted from private mkScalaInstance in sbt | |||
def makeScalaInstance( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the updated sbt-dotty plugin still work with previous versions of dotty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it does!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit lost in all the code of the bridge itself. But the areas that I do understand look good to me (besides smarter's comments).
6bd6929
to
b492fd8
Compare
@smarter this is ready for review.
|
@nicolasstucki: can you have a look at the tasty-related changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise the TASTy loading logic looks good
protected def fromTastySetup(files: List[AbstractFile])(using Context): Context = | ||
if ctx.settings.fromTasty.value then | ||
val newEntries: List[String] = files | ||
.filter(_.exists) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should report an error if the file does not exist. Is this done somewhere else now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've just added the error report!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! The last commit can be removed now that #10728 has been closed.
Once this is merged I'll take care of release a new sbt-dotty. |
Thanks! I've just rebased and removed the last commit. |
This PR bumps Zinc to
1.4.3
insbt-bridge
and provides an implementation of the newxsbti.CompilerInterface2
.It fixes a bug related to
CompilerInterface
that thexsbti.compile.analysis.SourceInfo
s returned by Zinc, when the compilation is successful, are empty whereas they should contain the warnings.It brings support for the sbt remote cache on Scala 3.
The old
xsbti.CompilerInterface
is kept because Mill still depends on an older version of Zinc (1.4.0-M1
which is closer to1.3.5
than it is to1.4.0
). That's also the reason whyscala3-compiler
depends on Zinc1.3.5
and not1.4.3
. As soon as Mill has upgraded to Zinc1.4.0
or greater we will be able to fully upgrade to1.4.3
.The
CompilerClassLoader
is not needed anymore bysbt-dotty
but it is kept because of Mill. Once com-lihaoyi/mill#1019 is merged and released we will be able to remove theCompilerClassLoader
.The below table sums up the compatibility of future
3.0.0-M3
with sbt and Mill:CompilerInterface
(withCompilerClassLoader
)CompilerBridge extends CompilerInterface2
CompilerInterface
(withCompilerClassLoader
)[test_sbt]