mirror of https://github.com/sbt/sbt.git
Set default value for download dir option of boostrap command
This commit is contained in:
parent
c89dc684c1
commit
c0f1ac8602
|
|
@ -16,11 +16,24 @@ case class Bootstrap(
|
||||||
|
|
||||||
import scala.collection.JavaConverters._
|
import scala.collection.JavaConverters._
|
||||||
|
|
||||||
if (!options.standalone && options.downloadDir.isEmpty) {
|
val helper = new Helper(
|
||||||
Console.err.println(s"Error: no download dir specified. Specify one with -D or --download-dir")
|
options.common,
|
||||||
Console.err.println("E.g. -D \"\\$HOME/.app-name/jars\"")
|
remainingArgs,
|
||||||
sys.exit(255)
|
isolated = options.isolated,
|
||||||
}
|
warnBaseLoaderNotFound = false
|
||||||
|
)
|
||||||
|
|
||||||
|
lazy val downloadDir =
|
||||||
|
if (options.downloadDir.isEmpty)
|
||||||
|
helper.baseDependencies.headOption match {
|
||||||
|
case Some(dep) =>
|
||||||
|
s"\\$$HOME/.coursier/bootstrap/${dep.module.organization}/${dep.module.name}"
|
||||||
|
case None =>
|
||||||
|
Console.err.println("Error: no dependencies specified.")
|
||||||
|
sys.exit(255)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
options.downloadDir
|
||||||
|
|
||||||
val (validProperties, wrongProperties) = options.property.partition(_.contains("="))
|
val (validProperties, wrongProperties) = options.property.partition(_.contains("="))
|
||||||
if (wrongProperties.nonEmpty) {
|
if (wrongProperties.nonEmpty) {
|
||||||
|
|
@ -68,13 +81,6 @@ case class Bootstrap(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val helper = new Helper(
|
|
||||||
options.common,
|
|
||||||
remainingArgs,
|
|
||||||
isolated = options.isolated,
|
|
||||||
warnBaseLoaderNotFound = false
|
|
||||||
)
|
|
||||||
|
|
||||||
val isolatedDeps = options.isolated.isolatedDeps(options.common.defaultArtifactType)
|
val isolatedDeps = options.isolated.isolatedDeps(options.common.defaultArtifactType)
|
||||||
|
|
||||||
val (_, isolatedArtifactFiles) =
|
val (_, isolatedArtifactFiles) =
|
||||||
|
|
@ -181,7 +187,7 @@ case class Bootstrap(
|
||||||
val properties = new Properties
|
val properties = new Properties
|
||||||
properties.setProperty("bootstrap.mainClass", mainClass)
|
properties.setProperty("bootstrap.mainClass", mainClass)
|
||||||
if (!options.standalone)
|
if (!options.standalone)
|
||||||
properties.setProperty("bootstrap.jarDir", options.downloadDir)
|
properties.setProperty("bootstrap.jarDir", downloadDir)
|
||||||
|
|
||||||
outputZip.putNextEntry(propsEntry)
|
outputZip.putNextEntry(propsEntry)
|
||||||
properties.store(outputZip, "")
|
properties.store(outputZip, "")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue