mirror of https://github.com/sbt/sbt.git
support earlier launchers
This commit is contained in:
parent
85835c6d22
commit
8836b83ba3
|
|
@ -13,6 +13,11 @@ object CommandSupport
|
|||
{
|
||||
def logger(s: State) = s get Keys.logged getOrElse ConsoleLogger()
|
||||
|
||||
// slightly better fallback in case of older launcher
|
||||
def bootDirectory(state: State): File =
|
||||
try { state.configuration.provider.scalaProvider.launcher.bootDirectory }
|
||||
catch { case e: NoSuchMethodError => new File(".").getAbsoluteFile }
|
||||
|
||||
private def canRead = (_: File).canRead
|
||||
def notReadable(files: Seq[File]): Seq[File] = files filterNot canRead
|
||||
def readable(files: Seq[File]): Seq[File] = files filter canRead
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@ object Classpaths
|
|||
moduleID <<= normalizedName.identity,
|
||||
defaultConfiguration in GlobalScope :== Some(Configurations.Compile),
|
||||
defaultConfigurationMapping in GlobalScope <<= defaultConfiguration{ case Some(d) => "*->" + d.name; case None => "*->*" },
|
||||
ivyPaths <<= (baseDirectory, appConfiguration) { (base, app) => new IvyPaths(base, Option(app.provider.scalaProvider.launcher.ivyHome)) },
|
||||
ivyPaths <<= (baseDirectory, appConfiguration) { (base, app) => new IvyPaths(base, bootIvyHome(app)) },
|
||||
otherResolvers <<= publishTo(_.toList),
|
||||
projectResolver <<= projectResolverTask,
|
||||
projectDependencies <<= projectDependenciesTask,
|
||||
|
|
@ -769,6 +769,11 @@ object Classpaths
|
|||
case _ => arts
|
||||
}
|
||||
}
|
||||
|
||||
// support earlier launchers
|
||||
def bootIvyHome(app: xsbti.AppConfiguration): Option[File] =
|
||||
try { Option(app.provider.scalaProvider.launcher.ivyHome) }
|
||||
catch { case _: NoSuchMethodError => None }
|
||||
}
|
||||
|
||||
trait BuildExtra
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ object IvyConsole
|
|||
lazy val command =
|
||||
Command.command(Name) { state =>
|
||||
val Dependencies(managed, repos, unmanaged) = parseDependencies(state.remainingCommands, CommandSupport.logger(state))
|
||||
val base = new File(state.configuration.provider.scalaProvider.launcher.bootDirectory, Name)
|
||||
val base = new File(CommandSupport.bootDirectory(state), Name)
|
||||
IO.createDirectory(base)
|
||||
|
||||
val (eval, structure) = Load.defaultLoad(state, base, CommandSupport.logger(state))
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ object Script
|
|||
val scriptArg = state.remainingCommands.headOption getOrElse error("No script file specified")
|
||||
val script = new File(scriptArg).getAbsoluteFile
|
||||
val hash = halve(Hash.toHex(Hash(script.getAbsolutePath)))
|
||||
val base = new File(state.configuration.provider.scalaProvider.launcher.bootDirectory, hash)
|
||||
val base = new File(CommandSupport.bootDirectory(state), hash)
|
||||
IO.createDirectory(base)
|
||||
|
||||
val (eval, structure) = Load.defaultLoad(state, base, CommandSupport.logger(state))
|
||||
|
|
|
|||
Loading…
Reference in New Issue