mirror of https://github.com/sbt/sbt.git
Manage Scala 3 instances
This commit is contained in:
parent
1b0c251a69
commit
c9478529e6
|
|
@ -1034,21 +1034,22 @@ object Defaults extends BuildCommon {
|
|||
}
|
||||
|
||||
def scalaInstanceFromUpdate: Initialize[Task[ScalaInstance]] = Def.task {
|
||||
val sv = scalaVersion.value
|
||||
val toolReport = update.value.configuration(Configurations.ScalaTool) getOrElse
|
||||
sys.error(noToolConfiguration(managedScalaInstance.value))
|
||||
def files(id: String) =
|
||||
for {
|
||||
m <- toolReport.modules if m.module.name == id;
|
||||
m <- toolReport.modules if m.module.name.startsWith(id)
|
||||
(art, file) <- m.artifacts if art.`type` == Artifact.DefaultType
|
||||
} yield file
|
||||
def file(id: String) = files(id).headOption getOrElse sys.error(s"Missing ${id}.jar")
|
||||
def file(id: String) = files(id).headOption getOrElse sys.error(s"Missing $id jar file")
|
||||
val allJars = toolReport.modules.flatMap(_.artifacts.map(_._2))
|
||||
val libraryJar = file(ScalaArtifacts.LibraryID)
|
||||
val compilerJar = file(ScalaArtifacts.CompilerID)
|
||||
val libraryJars = ScalaArtifacts.libraryIds(sv).map(file)
|
||||
val compilerJar = file(ScalaArtifacts.compilerId(sv))
|
||||
mkScalaInstance(
|
||||
scalaVersion.value,
|
||||
sv,
|
||||
allJars,
|
||||
Array(libraryJar),
|
||||
libraryJars,
|
||||
compilerJar,
|
||||
state.value.extendedClassLoaderCache,
|
||||
scalaInstanceTopLoader.value,
|
||||
|
|
@ -3820,7 +3821,7 @@ object Classpaths {
|
|||
version: String
|
||||
): Seq[ModuleID] =
|
||||
if (auto)
|
||||
modifyForPlugin(plugin, ModuleID(org, ScalaArtifacts.LibraryID, version)) :: Nil
|
||||
modifyForPlugin(plugin, ScalaArtifacts.libraryDependency(org, version)) :: Nil
|
||||
else
|
||||
Nil
|
||||
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ object LMCoursier {
|
|||
}
|
||||
|
||||
def coursierConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
|
||||
val sv = scalaVersion.value
|
||||
coursierConfiguration(
|
||||
csrRecursiveResolvers.value,
|
||||
csrInterProjectDependencies.value.toVector,
|
||||
|
|
@ -182,9 +183,9 @@ object LMCoursier {
|
|||
None,
|
||||
csrMavenProfiles.value,
|
||||
scalaOrganization.value,
|
||||
scalaVersion.value,
|
||||
sv,
|
||||
scalaBinaryVersion.value,
|
||||
autoScalaLibrary.value,
|
||||
autoScalaLibrary.value && !ScalaArtifacts.isScala3(sv),
|
||||
scalaModuleInfo.value,
|
||||
allExcludeDependencies.value,
|
||||
CoursierInputsTasks.credentialsTask.value,
|
||||
|
|
@ -200,6 +201,7 @@ object LMCoursier {
|
|||
}
|
||||
|
||||
def updateClassifierConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
|
||||
val sv = scalaVersion.value
|
||||
coursierConfiguration(
|
||||
csrRecursiveResolvers.value,
|
||||
csrInterProjectDependencies.value.toVector,
|
||||
|
|
@ -209,9 +211,9 @@ object LMCoursier {
|
|||
Some(transitiveClassifiers.value.map(Classifier(_))),
|
||||
csrMavenProfiles.value,
|
||||
scalaOrganization.value,
|
||||
scalaVersion.value,
|
||||
sv,
|
||||
scalaBinaryVersion.value,
|
||||
autoScalaLibrary.value,
|
||||
autoScalaLibrary.value && !ScalaArtifacts.isScala3(sv),
|
||||
scalaModuleInfo.value,
|
||||
allExcludeDependencies.value,
|
||||
CoursierInputsTasks.credentialsTask.value,
|
||||
|
|
@ -227,6 +229,7 @@ object LMCoursier {
|
|||
}
|
||||
|
||||
def updateSbtClassifierConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
|
||||
val sv = scalaVersion.value
|
||||
coursierConfiguration(
|
||||
csrSbtResolvers.value,
|
||||
Vector(),
|
||||
|
|
@ -236,9 +239,9 @@ object LMCoursier {
|
|||
None,
|
||||
csrMavenProfiles.value,
|
||||
scalaOrganization.value,
|
||||
scalaVersion.value,
|
||||
sv,
|
||||
scalaBinaryVersion.value,
|
||||
autoScalaLibrary.value,
|
||||
autoScalaLibrary.value && !ScalaArtifacts.isScala3(sv),
|
||||
scalaModuleInfo.value,
|
||||
allExcludeDependencies.value,
|
||||
CoursierInputsTasks.credentialsTask.value,
|
||||
|
|
@ -254,6 +257,7 @@ object LMCoursier {
|
|||
}
|
||||
|
||||
def scalaCompilerBridgeConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
|
||||
val sv = scalaVersion.value
|
||||
coursierConfiguration(
|
||||
csrResolvers.value,
|
||||
Vector(),
|
||||
|
|
@ -263,9 +267,9 @@ object LMCoursier {
|
|||
None,
|
||||
csrMavenProfiles.value,
|
||||
scalaOrganization.value,
|
||||
scalaVersion.value,
|
||||
sv,
|
||||
scalaBinaryVersion.value,
|
||||
autoScalaLibrary.value,
|
||||
autoScalaLibrary.value && !ScalaArtifacts.isScala3(sv),
|
||||
scalaModuleInfo.value,
|
||||
allExcludeDependencies.value,
|
||||
CoursierInputsTasks.credentialsTask.value,
|
||||
|
|
|
|||
Loading…
Reference in New Issue