diff --git a/launch/BootConfiguration.scala b/launch/BootConfiguration.scala index 5b835ceec..aed6c77dc 100644 --- a/launch/BootConfiguration.scala +++ b/launch/BootConfiguration.scala @@ -72,23 +72,23 @@ private object BootConfiguration * containing all jars for the requested version of scala. */ def appRetrievePattern(appID: xsbti.ApplicationID) = appDirectoryName(appID, "/") + "(/[component])/[artifact]-[revision](-[classifier]).[ext]" - val ScalaVersionPrefix = ".scala-" + val ScalaVersionPrefix = "scala-" /** The name of the directory to retrieve the application and its dependencies to.*/ def appDirectoryName(appID: xsbti.ApplicationID, sep: String) = appID.groupID + sep + appID.name + sep + appID.version /** The name of the directory in the boot directory to put all jars for the given version of scala in.*/ def baseDirectoryName(scalaOrg: String, scalaVersion: Option[String]) = scalaVersion match { case None => "other" - case Some(sv) => scalaOrg + ScalaVersionPrefix + sv + case Some(sv) => (if (scalaOrg == ScalaOrg) "" else scalaOrg + ".") + ScalaVersionPrefix + sv } def extractScalaVersion(dir: File): Option[String] = { val name = dir.getName if(name.contains(ScalaVersionPrefix)) - Some(name.substring(name.lastIndexOf(ScalaVersionPrefix) + ScalaVersionPrefix.length)) + Some(name.substring(name.lastIndexOf(ScalaVersionPrefix) + ScalaVersionPrefix.length)) else - None + None } } private object ProxyProperties diff --git a/launch/Update.scala b/launch/Update.scala index 767e4057d..23816e467 100644 --- a/launch/Update.scala +++ b/launch/Update.scala @@ -134,7 +134,8 @@ final class Update(config: UpdateConfiguration) addDependency(moduleID, scalaOrg, CompilerModuleName, scalaVersion, "default;optional(default)", u.classifiers) addDependency(moduleID, scalaOrg, LibraryModuleName, scalaVersion, "default", u.classifiers) excludeJUnit(moduleID) - System.out.println("Getting " + scalaOrg + " Scala " + scalaVersion + " " + reason + "...") + val scalaOrgString = if (scalaOrg != ScalaOrg) " " + scalaOrg else "" + System.out.println("Getting" + scalaOrgString + " Scala " + scalaVersion + " " + reason + "...") case u: UpdateApp => val app = u.id val resolvedName = (app.crossVersioned, scalaVersion) match { diff --git a/util/classpath/ScalaInstance.scala b/util/classpath/ScalaInstance.scala index 84f6269f0..9b687c9b5 100644 --- a/util/classpath/ScalaInstance.scala +++ b/util/classpath/ScalaInstance.scala @@ -21,18 +21,19 @@ final class ScalaInstance(val version: String, val loader: ClassLoader, val libr } object ScalaInstance { + val ScalaOrg = "org.scala-lang" val VersionPrefix = "version " - def apply(org: String, version: String, launcher: xsbti.Launcher): ScalaInstance = { - // launcher compatibility check - val strClass = "".getClass - if (launcher.getClass.getMethods.exists(m => - m.getName == "getScala" && - m.getParameterTypes.toSeq == Seq(strClass, strClass, strClass))) - apply(version, launcher.getScala(version, "", org)) - else - error("Incompatible version of the xsbti.Launcher interface. Use sbt-0.12.x launcher instead.") - } + def apply(org: String, version: String, launcher: xsbti.Launcher): ScalaInstance = + // Due to incompatibility with previous launchers if scalaOrg has default value revert to an existing method + if (org == ScalaOrg) + apply(version, launcher) + else try { + apply(version, launcher.getScala(version, "", org)) + } catch { + case x: NoSuchMethodError => error("Incompatible version of the xsbti.Launcher interface. Use sbt-0.12.x launcher instead.") + } + /** Creates a ScalaInstance using the given provider to obtain the jars and loader.*/ def apply(version: String, launcher: xsbti.Launcher): ScalaInstance = apply(version, launcher.getScala(version))