diff --git a/backend/src/main/scala/bloop/ScalaInstance.scala b/backend/src/main/scala/bloop/ScalaInstance.scala index f7771d3464..b88e202274 100644 --- a/backend/src/main/scala/bloop/ScalaInstance.scala +++ b/backend/src/main/scala/bloop/ScalaInstance.scala @@ -17,6 +17,8 @@ import bloop.internal.build.BloopScalaInfo import bloop.logging.DebugFilter import bloop.logging.Logger +import coursierapi.Repository + final class ScalaInstance private ( val organization: String, val name: String, @@ -195,12 +197,14 @@ object ScalaInstance { scalaOrg: String, scalaName: String, scalaVersion: String, - logger: Logger + logger: Logger, + additionalRepositories: List[Repository] = Nil ): ScalaInstance = { def resolveInstance: ScalaInstance = { val allPaths = DependencyResolution.resolve( List(DependencyResolution.Artifact(scalaOrg, scalaName, scalaVersion)), - logger + logger, + additionalRepos = additionalRepositories ) val allJars = allPaths.collect { case path if path.underlying.toString.endsWith(".jar") => path.underlying.toFile diff --git a/backend/src/main/scala/sbt/internal/inc/BloopComponentCompiler.scala b/backend/src/main/scala/sbt/internal/inc/BloopComponentCompiler.scala index 113636b399..32d84a8405 100644 --- a/backend/src/main/scala/sbt/internal/inc/BloopComponentCompiler.scala +++ b/backend/src/main/scala/sbt/internal/inc/BloopComponentCompiler.scala @@ -27,6 +27,7 @@ import xsbti.ComponentProvider import xsbti.Logger import xsbti.compile.ClasspathOptionsUtil import xsbti.compile.CompilerBridgeProvider +import scala.util.control.NonFatal object BloopComponentCompiler { import xsbti.compile.ScalaInstance @@ -44,11 +45,22 @@ object BloopComponentCompiler { private val CompileConf = Some(Configurations.Compile.name) def getModuleForBridgeSources(scalaInstance: ScalaInstance): ModuleID = { + val isAfter2_13_11 = + try { + val Array(_, _, patch) = scalaInstance.version().split("\\.") + val patchTrimmed = patch.takeWhile(_.isDigit).toInt + scalaInstance.version().startsWith("2.13.") && patchTrimmed >= 12 + } catch { + case NonFatal(_) => false + } + def compilerBridgeId(scalaVersion: String) = { + // Defaults to bridge for 2.13 for Scala versions bigger than 2.13.x scalaVersion match { case sc if (sc startsWith "0.") => "dotty-sbt-bridge" case sc if (sc startsWith "3.") => "scala3-sbt-bridge" + case _ if isAfter2_13_11 => "scala2-sbt-bridge" case sc if (sc startsWith "2.10.") => "compiler-bridge_2.10" case sc if (sc startsWith "2.11.") => "compiler-bridge_2.11" case sc if (sc startsWith "2.12.") => "compiler-bridge_2.12" @@ -57,7 +69,7 @@ object BloopComponentCompiler { } val (isDotty, organization, version) = scalaInstance match { - case instance: BloopScalaInstance if instance.isDotty => + case instance: BloopScalaInstance if instance.isDotty || isAfter2_13_11 => (true, instance.organization, instance.version) case _ => (false, "org.scala-sbt", latestVersion) } @@ -250,7 +262,12 @@ private[inc] class BloopComponentCompiler( .Artifact(bridgeSources.organization, bridgeSources.name, bridgeSources.revision) ), logger, - resolveSources = shouldResolveSources + resolveSources = shouldResolveSources, + List( + coursierapi.MavenRepository.of( + "https://scala-ci.typesafe.com/artifactory/scala-integration/" + ) + ) ) match { case Right(paths) => paths.map(_.underlying).toVector case Left(t) => diff --git a/frontend/src/test/scala/bloop/ScalaVersionsSpec.scala b/frontend/src/test/scala/bloop/ScalaVersionsSpec.scala index ce9f5f737a..fbfbe89791 100644 --- a/frontend/src/test/scala/bloop/ScalaVersionsSpec.scala +++ b/frontend/src/test/scala/bloop/ScalaVersionsSpec.scala @@ -10,6 +10,8 @@ import bloop.task.Task import bloop.util.TestProject import bloop.util.TestUtil +import coursierapi.MavenRepository + object ScalaVersionsSpec extends bloop.testing.BaseSuite { var loggers: List[RecordingLogger] = Nil @@ -22,7 +24,15 @@ object ScalaVersionsSpec extends bloop.testing.BaseSuite { def jarsForScalaVersion(version: String, logger: RecordingLogger) = { ScalaInstance - .resolve(compilerOrg, compilerArtifact, version, logger) + .resolve( + compilerOrg, + compilerArtifact, + version, + logger, + List( + MavenRepository.of("https://scala-ci.typesafe.com/artifactory/scala-integration/") + ) + ) .allJars .map(AbsolutePath(_)) } @@ -71,7 +81,8 @@ object ScalaVersionsSpec extends bloop.testing.BaseSuite { "2.12.17", "2.13.10", "3.1.3", - "3.2.1" + "3.2.1", + "2.13.12-bin-86f40c2" ) val allVersions = if (TestUtil.isJdk8) jdk8OnlyVersions ++ scalaVersions else scalaVersions