mirror of https://github.com/sbt/sbt.git
clean up scalaOrg changes
This commit is contained in:
parent
2aad26a5ba
commit
2a84a80d5b
|
|
@ -6,11 +6,12 @@
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
// <boot.directory>
|
// <boot.directory>
|
||||||
// scala-<scala.version>/ [baseDirectoryName]
|
// [<scala-org>.]scala-<scala.version>/ [baseDirectoryName]
|
||||||
// lib/ [ScalaDirectoryName]
|
// lib/ [ScalaDirectoryName]
|
||||||
// <app.name>-<app.version>/ [appDirectoryName]
|
// <app.name>-<app.version>/ [appDirectoryName]
|
||||||
//
|
//
|
||||||
// see also ProjectProperties for the set of constants that apply to the build.properties file in a project
|
// see also ProjectProperties for the set of constants that apply to the build.properties file in a project
|
||||||
|
// The scala organization is used as a prefix in baseDirectoryName when a non-standard organization is used.
|
||||||
private object BootConfiguration
|
private object BootConfiguration
|
||||||
{
|
{
|
||||||
// these are the Scala module identifiers to resolve/retrieve
|
// these are the Scala module identifiers to resolve/retrieve
|
||||||
|
|
@ -53,11 +54,11 @@ private object BootConfiguration
|
||||||
|
|
||||||
val DefaultIvyConfiguration = "default"
|
val DefaultIvyConfiguration = "default"
|
||||||
|
|
||||||
|
/** The name of the directory within the boot directory to retrieve scala to. */
|
||||||
val ScalaDirectoryName = "lib"
|
val ScalaDirectoryName = "lib"
|
||||||
|
|
||||||
/** The Ivy pattern to use for retrieving the scala compiler and library. It is relative to the directory
|
/** The Ivy pattern to use for retrieving the scala compiler and library. It is relative to the directory
|
||||||
* containing all jars for the requested version of scala.
|
* containing all jars for the requested version of scala. */
|
||||||
*/
|
|
||||||
val scalaRetrievePattern = ScalaDirectoryName + "/[artifact](-[classifier]).[ext]"
|
val scalaRetrievePattern = ScalaDirectoryName + "/[artifact](-[classifier]).[ext]"
|
||||||
|
|
||||||
def artifactType(classifier: String) =
|
def artifactType(classifier: String) =
|
||||||
|
|
@ -81,7 +82,7 @@ private object BootConfiguration
|
||||||
case None => "other"
|
case None => "other"
|
||||||
case Some(sv) => (if (scalaOrg == ScalaOrg) "" else scalaOrg + ".") + ScalaVersionPrefix + sv
|
case Some(sv) => (if (scalaOrg == ScalaOrg) "" else scalaOrg + ".") + ScalaVersionPrefix + sv
|
||||||
}
|
}
|
||||||
|
|
||||||
def extractScalaVersion(dir: File): Option[String] =
|
def extractScalaVersion(dir: File): Option[String] =
|
||||||
{
|
{
|
||||||
val name = dir.getName
|
val name = dir.getName
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class Launch private[xsbt](val bootDirectory: File, val lockBoot: Boolean, val i
|
||||||
def getScala(version: String, reason: String): xsbti.ScalaProvider = getScala(version, reason, ScalaOrg)
|
def getScala(version: String, reason: String): xsbti.ScalaProvider = getScala(version, reason, ScalaOrg)
|
||||||
def getScala(version: String, reason: String, scalaOrg: String) = scalaProviders((scalaOrg, version), reason)
|
def getScala(version: String, reason: String, scalaOrg: String) = scalaProviders((scalaOrg, version), reason)
|
||||||
def app(id: xsbti.ApplicationID, version: String): xsbti.AppProvider = app(id, Option(version))
|
def app(id: xsbti.ApplicationID, version: String): xsbti.AppProvider = app(id, Option(version))
|
||||||
def app(id: xsbti.ApplicationID, scalaVersion: Option[String]): xsbti.AppProvider =
|
def app(id: xsbti.ApplicationID, scalaVersion: Option[String]): xsbti.AppProvider =
|
||||||
getAppProvider(id, scalaVersion, false)
|
getAppProvider(id, scalaVersion, false)
|
||||||
|
|
||||||
val bootLoader = new BootFilteredLoader(getClass.getClassLoader)
|
val bootLoader = new BootFilteredLoader(getClass.getClassLoader)
|
||||||
|
|
@ -150,7 +150,7 @@ class Launch private[xsbt](val bootDirectory: File, val lockBoot: Boolean, val i
|
||||||
retrieve()
|
retrieve()
|
||||||
else
|
else
|
||||||
existing(app, ScalaOrg, explicitScalaVersion, baseDirs) getOrElse retrieve()
|
existing(app, ScalaOrg, explicitScalaVersion, baseDirs) getOrElse retrieve()
|
||||||
|
|
||||||
val scalaVersion = getOrError(strictOr(explicitScalaVersion, retrievedApp.detectedScalaVersion), "No Scala version specified or detected")
|
val scalaVersion = getOrError(strictOr(explicitScalaVersion, retrievedApp.detectedScalaVersion), "No Scala version specified or detected")
|
||||||
val scalaProvider = getScala(scalaVersion, "(for " + id.name + ")")
|
val scalaProvider = getScala(scalaVersion, "(for " + id.name + ")")
|
||||||
|
|
||||||
|
|
@ -174,7 +174,7 @@ class Launch private[xsbt](val bootDirectory: File, val lockBoot: Boolean, val i
|
||||||
def getScalaProvider(scalaOrg: String, scalaVersion: String, reason: String): xsbti.ScalaProvider =
|
def getScalaProvider(scalaOrg: String, scalaVersion: String, reason: String): xsbti.ScalaProvider =
|
||||||
locked(new Callable[xsbti.ScalaProvider] { def call = getScalaProvider0(scalaOrg, scalaVersion, reason) })
|
locked(new Callable[xsbti.ScalaProvider] { def call = getScalaProvider0(scalaOrg, scalaVersion, reason) })
|
||||||
|
|
||||||
private[this] final def getScalaProvider0(scalaOrg: String, scalaVersion: String, reason: String) =
|
private[this] final def getScalaProvider0(scalaOrg: String, scalaVersion: String, reason: String) =
|
||||||
{
|
{
|
||||||
val scalaM = scalaModule(scalaOrg, scalaVersion)
|
val scalaM = scalaModule(scalaOrg, scalaVersion)
|
||||||
val (scalaHome, lib) = scalaDirs(scalaM, scalaOrg, scalaVersion)
|
val (scalaHome, lib) = scalaDirs(scalaM, scalaOrg, scalaVersion)
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,14 @@ final case class LaunchConfiguration(scalaVersion: Value[String], ivyConfigurati
|
||||||
val sv = Value.get(scalaVersion)
|
val sv = Value.get(scalaVersion)
|
||||||
if(sv == "auto") None else Some(sv)
|
if(sv == "auto") None else Some(sv)
|
||||||
}
|
}
|
||||||
|
|
||||||
def withScalaVersion(newScalaVersion: String) = LaunchConfiguration(new Explicit(newScalaVersion), ivyConfiguration, app, boot, logging, appProperties)
|
def withScalaVersion(newScalaVersion: String) = LaunchConfiguration(new Explicit(newScalaVersion), ivyConfiguration, app, boot, logging, appProperties)
|
||||||
def withApp(app: Application) = LaunchConfiguration(scalaVersion, ivyConfiguration, app, boot, logging, appProperties)
|
def withApp(app: Application) = LaunchConfiguration(scalaVersion, ivyConfiguration, app, boot, logging, appProperties)
|
||||||
def withAppVersion(newAppVersion: String) = LaunchConfiguration(scalaVersion, ivyConfiguration, app.withVersion(new Explicit(newAppVersion)), boot, logging, appProperties)
|
def withAppVersion(newAppVersion: String) = LaunchConfiguration(scalaVersion, ivyConfiguration, app.withVersion(new Explicit(newAppVersion)), boot, logging, appProperties)
|
||||||
// TODO: withExplicit
|
// TODO: withExplicit
|
||||||
def withVersions(newScalaVersion: String, newAppVersion: String, classifiers0: Classifiers) =
|
def withVersions(newScalaVersion: String, newAppVersion: String, classifiers0: Classifiers) =
|
||||||
LaunchConfiguration(new Explicit(newScalaVersion), ivyConfiguration.copy(classifiers = classifiers0), app.withVersion(new Explicit(newAppVersion)), boot, logging, appProperties)
|
LaunchConfiguration(new Explicit(newScalaVersion), ivyConfiguration.copy(classifiers = classifiers0), app.withVersion(new Explicit(newAppVersion)), boot, logging, appProperties)
|
||||||
|
|
||||||
def map(f: File => File) = LaunchConfiguration(scalaVersion, ivyConfiguration, app.map(f), boot.map(f), logging, appProperties)
|
def map(f: File => File) = LaunchConfiguration(scalaVersion, ivyConfiguration, app.map(f), boot.map(f), logging, appProperties)
|
||||||
}
|
}
|
||||||
final case class IvyOptions(ivyHome: Option[File], classifiers: Classifiers, repositories: List[xsbti.Repository], checksums: List[String])
|
final case class IvyOptions(ivyHome: Option[File], classifiers: Classifiers, repositories: List[xsbti.Repository], checksums: List[String])
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,7 @@ final class UpdateApp(val id: Application, val classifiers: List[String], val tp
|
||||||
final class UpdateConfiguration(val bootDirectory: File, val ivyHome: Option[File], val scalaOrg: String,
|
final class UpdateConfiguration(val bootDirectory: File, val ivyHome: Option[File], val scalaOrg: String,
|
||||||
val scalaVersion: Option[String], val repositories: List[xsbti.Repository], val checksums: List[String]) {
|
val scalaVersion: Option[String], val repositories: List[xsbti.Repository], val checksums: List[String]) {
|
||||||
|
|
||||||
def getScalaVersion = scalaVersion match { case Some(sv) => sv; case None => "" }
|
def getScalaVersion = scalaVersion match { case Some(sv) => sv; case None => "" }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final class UpdateResult(val success: Boolean, val scalaVersion: Option[String])
|
final class UpdateResult(val success: Boolean, val scalaVersion: Option[String])
|
||||||
|
|
@ -130,7 +129,7 @@ final class Update(config: UpdateConfiguration)
|
||||||
target match
|
target match
|
||||||
{
|
{
|
||||||
case u: UpdateScala =>
|
case u: UpdateScala =>
|
||||||
val scalaVersion = getScalaVersion
|
val scalaVersion = getScalaVersion
|
||||||
addDependency(moduleID, scalaOrg, CompilerModuleName, scalaVersion, "default;optional(default)", u.classifiers)
|
addDependency(moduleID, scalaOrg, CompilerModuleName, scalaVersion, "default;optional(default)", u.classifiers)
|
||||||
addDependency(moduleID, scalaOrg, LibraryModuleName, scalaVersion, "default", u.classifiers)
|
addDependency(moduleID, scalaOrg, LibraryModuleName, scalaVersion, "default", u.classifiers)
|
||||||
excludeJUnit(moduleID)
|
excludeJUnit(moduleID)
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ object ScalaInstance
|
||||||
{
|
{
|
||||||
val ScalaOrg = "org.scala-lang"
|
val ScalaOrg = "org.scala-lang"
|
||||||
val VersionPrefix = "version "
|
val VersionPrefix = "version "
|
||||||
|
|
||||||
def apply(org: String, version: String, launcher: xsbti.Launcher): ScalaInstance =
|
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
|
// Due to incompatibility with previous launchers if scalaOrg has default value revert to an existing method
|
||||||
if (org == ScalaOrg)
|
if (org == ScalaOrg)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue