Scala compiler plugin support

**Problem**
Compiler options for the compiler plugins ends up capturing the absolute path, specific to the machine.

**Solution**
This encodes the plugin paths as virtual paths.
This commit is contained in:
Eugene Yokota 2025-04-28 03:10:44 -04:00
parent 187eb0f584
commit 2fd08caeda
2 changed files with 6 additions and 5 deletions

View File

@ -995,7 +995,7 @@ object Defaults extends BuildCommon {
Vector(
"-Ypickle-java",
"-Ypickle-write",
converter.toPath(earlyOutput.value).toString
earlyOutput.value.toString
) ++ old
else old
},
@ -4221,18 +4221,19 @@ object Classpaths {
given FileConverter = converter
(base * (filter -- excl) +++ (base / config.name).descendantsExcept(filter, excl)).classpath
def autoPlugins(
private def autoPlugins(
report: UpdateReport,
internalPluginClasspath: Seq[NioPath],
isDotty: Boolean
): Seq[String] =
)(using conv: FileConverter): Seq[String] =
import sbt.internal.inc.classpath.ClasspathUtil.compilerPlugins
val pluginClasspath =
report
.matching(configurationFilter(CompilerPlugin.name))
.map(_.toPath) ++ internalPluginClasspath
val plugins = compilerPlugins(pluginClasspath, isDotty)
plugins.map("-Xplugin:" + _.toAbsolutePath.toString).toSeq
plugins.toVector.map: p =>
"-Xplugin:" + conv.toVirtualFile(p).toString()
private lazy val internalCompilerPluginClasspath: Initialize[Task[Classpath]] =
(Def

View File

@ -12,7 +12,7 @@ object Dependencies {
// sbt modules
private val ioVersion = nightlyVersion.getOrElse("1.10.4")
val zincVersion = nightlyVersion.getOrElse("2.0.0-M3")
val zincVersion = nightlyVersion.getOrElse("2.0.0-M4")
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion