diff --git a/ci-test/app2/sbt.1.4.0.boot.properties b/ci-test/app2/sbt.1.4.0.boot.properties index 95d0187..3256a11 100644 --- a/ci-test/app2/sbt.1.4.0.boot.properties +++ b/ci-test/app2/sbt.1.4.0.boot.properties @@ -12,8 +12,6 @@ [repositories] local - local-preloaded-ivy: file:///${sbt.preloaded-${sbt.global.base-${user.home}/.sbt}/preloaded/}, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext] - local-preloaded: file:///${sbt.preloaded-${sbt.global.base-${user.home}/.sbt}/preloaded/} maven-central sbt-maven-releases: https://repo.scala-sbt.org/scalasbt/maven-releases/, bootOnly sbt-maven-snapshots: https://repo.scala-sbt.org/scalasbt/maven-snapshots/, bootOnly diff --git a/launcher-implementation/src/main/scala/xsbt/boot/CoursierUpdate.scala b/launcher-implementation/src/main/scala/xsbt/boot/CoursierUpdate.scala index 9c09a5e..1cd9ab2 100644 --- a/launcher-implementation/src/main/scala/xsbt/boot/CoursierUpdate.scala +++ b/launcher-implementation/src/main/scala/xsbt/boot/CoursierUpdate.scala @@ -7,6 +7,7 @@ import coursier.core.{ Publication, Repository } import coursier.credentials.DirectCredentials import coursier.ivy.IvyRepository import coursier.maven.MavenRepository +import coursier.params.ResolutionParams import java.io.{ File, FileWriter, PrintWriter } import java.nio.file.{ Files, StandardCopyOption, Paths } import java.util.Properties @@ -108,10 +109,19 @@ class CousierUpdate(config: UpdateConfiguration) { deps: List[Dependency] ): UpdateResult = { val repos = config.repositories.map(toCoursierRepository) + val params = scalaVersion match { + case Some(sv) if sv != "auto" => + ResolutionParams() + .withScalaVersion(sv) + .withForceScalaVersion(true) + case _ => + ResolutionParams() + } val r: Resolution = Resolve() .withCache(coursierCache) .addDependencies(deps: _*) .withRepositories(repos) + .withResolutionParams(params) .run() val actualScalaVersion = (r.dependencySet.set collect { @@ -143,6 +153,7 @@ class CousierUpdate(config: UpdateConfiguration) { .withCache(coursierCache) .addDependencies(deps: _*) .withRepositories(repos) + .withResolutionParams(params) .run() downloadedJars foreach { downloaded => val t = diff --git a/launcher-implementation/src/main/scala/xsbt/boot/Launch.scala b/launcher-implementation/src/main/scala/xsbt/boot/Launch.scala index 5fde4bf..11b927e 100644 --- a/launcher-implementation/src/main/scala/xsbt/boot/Launch.scala +++ b/launcher-implementation/src/main/scala/xsbt/boot/Launch.scala @@ -306,9 +306,20 @@ class Launch private[xsbt] ( @tailrec private[this] final def getAppProvider0( id: xsbti.ApplicationID, - explicitScalaVersion: Option[String], + explicitScalaVersion0: Option[String], forceAppUpdate: Boolean ): xsbti.AppProvider = { + val explicitScalaVersion = explicitScalaVersion0 match { + case Some(sv) => Some(sv) + case _ => + // https://github.com/sbt/sbt/issues/6587 + // set the Scala version of sbt 1.4.x series to 2.12.12 explicitly + // since util-interface depends on Scala 2.13 by mistake + // https://github.com/sbt/sbt/blob/v1.4.0/project/Dependencies.scala + if (id.groupID() == "org.scala-sbt" && + id.name() == "sbt" && id.version().startsWith("1.4.")) Some("2.12.12") + else None + } val app = appModule(id, explicitScalaVersion, true, "app") /** Replace the version of an ApplicationID with the given one, if set. */