mirror of https://github.com/sbt/sbt.git
Minimizing effects of scalaOrganization key addition.
This commit is contained in:
parent
cbb8caef0c
commit
079a2c1bda
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in New Issue