Use the ordinary compiler classpath for scala-library

No longer pass `-bootclasspath /path/to/scala-library.jar` to the Scala
compiler, put the library on the ordinary classpath.
This commit is contained in:
Lukas Rytz 2024-01-22 16:29:46 +01:00
parent 48c23761dc
commit d8d2b02e7e
5 changed files with 21 additions and 4 deletions

View File

@ -730,14 +730,14 @@ object Defaults extends BuildCommon {
consoleProject / scalaCompilerBridgeSource := ZincLmUtil.getDefaultBridgeSourceModule( consoleProject / scalaCompilerBridgeSource := ZincLmUtil.getDefaultBridgeSourceModule(
appConfiguration.value.provider.scalaProvider.version appConfiguration.value.provider.scalaProvider.version
), ),
classpathOptions := ClasspathOptionsUtil.noboot(scalaVersion.value),
console / classpathOptions := ClasspathOptionsUtil.replNoboot(scalaVersion.value),
) )
// must be a val: duplication detected by object identity // must be a val: duplication detected by object identity
private[this] lazy val compileBaseGlobal: Seq[Setting[_]] = globalDefaults( private[this] lazy val compileBaseGlobal: Seq[Setting[_]] = globalDefaults(
Seq( Seq(
auxiliaryClassFiles :== Nil, auxiliaryClassFiles :== Nil,
incOptions := IncOptions.of(), incOptions := IncOptions.of(),
classpathOptions :== ClasspathOptionsUtil.boot,
console / classpathOptions :== ClasspathOptionsUtil.repl,
compileOrder :== CompileOrder.Mixed, compileOrder :== CompileOrder.Mixed,
javacOptions :== Nil, javacOptions :== Nil,
scalacOptions :== Nil, scalacOptions :== Nil,

View File

@ -79,7 +79,7 @@ private[sbt] object Load {
val dependencyResolution = IvyDependencyResolution(ivyConfiguration) val dependencyResolution = IvyDependencyResolution(ivyConfiguration)
val si = ScalaInstance(scalaProvider.version, scalaProvider.launcher) val si = ScalaInstance(scalaProvider.version, scalaProvider.launcher)
val zincDir = BuildPaths.getZincDirectory(state, globalBase) val zincDir = BuildPaths.getZincDirectory(state, globalBase)
val classpathOptions = ClasspathOptionsUtil.boot val classpathOptions = ClasspathOptionsUtil.noboot(si.version)
val scalac = ZincLmUtil.scalaCompiler( val scalac = ZincLmUtil.scalaCompiler(
scalaInstance = si, scalaInstance = si,
classpathOptions = classpathOptions, classpathOptions = classpathOptions,

View File

@ -0,0 +1,9 @@
TaskKey[Unit]("check212") := checkCp(true)
TaskKey[Unit]("check213") := checkCp(false)
def checkCp(auto: Boolean) = Def.task {
val opts = compilers.value.scalac.classpathOptions
assert(opts.autoBoot == auto, opts)
assert(opts.filterLibrary == auto, opts)
()
}

View File

@ -0,0 +1,4 @@
> set scalaVersion := "2.13.12"
> check213
> set scalaVersion := "2.12.18"
> check212

View File

@ -57,7 +57,11 @@ private[sbt] object ZincComponentCompiler {
scalaInstance: XScalaInstance, scalaInstance: XScalaInstance,
logger: Logger, logger: Logger,
): File = lock.synchronized { ): File = lock.synchronized {
val raw = new RawCompiler(scalaInstance, ClasspathOptionsUtil.auto, logger) val raw = new RawCompiler(
scalaInstance,
ClasspathOptionsUtil.autoNoboot(scalaInstance.version),
logger
)
val zinc = val zinc =
new ZincComponentCompiler(raw, manager, dependencyResolution, bridgeSources, logger) new ZincComponentCompiler(raw, manager, dependencyResolution, bridgeSources, logger)
logger.debug(f0(s"Getting $bridgeSources for Scala ${scalaInstance.version}")) logger.debug(f0(s"Getting $bridgeSources for Scala ${scalaInstance.version}"))