Fix handling of `--no-share` option

Using `--no-share` as a command line option resulted in a single additional
argument added to the java command:

`-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy`

Actually, three separate arguments need to be added.
This commit is contained in:
Claudio Bley 2020-09-24 11:29:15 +02:00
parent f170d29481
commit a7c034aa99
2 changed files with 10 additions and 2 deletions

View File

@ -229,4 +229,12 @@ object SbtRunnerTest extends SimpleTestSuite with PowerAssertions {
}
()
}
test("sbt --no-share adds three system properties") {
val out = sbtProcess("--no-share").!!.linesIterator.toList
assert(out.contains[String]("-Dsbt.global.base=project/.sbtboot"))
assert(out.contains[String]("-Dsbt.boot.directory=project/.boot"))
assert(out.contains[String]("-Dsbt.ivy.home=project/.ivy"))
()
}
}

View File

@ -403,7 +403,7 @@ run() {
exit $exit_code
}
declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy"
declare -ra noshare_opts=(-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy)
declare -r sbt_opts_file=".sbtopts"
declare -r build_props_file="$(pwd)/project/build.properties"
declare -r etc_sbt_opts_file="/etc/sbt/sbtopts"
@ -513,7 +513,7 @@ map_args () {
-supershell=*) options=( "${options[@]}" "-Dsbt.supershell=${1:12}" ) && shift ;;
--color=*) options=( "${options[@]}" "-Dsbt.color=${1:8}" ) && shift ;;
-color=*) options=( "${options[@]}" "-Dsbt.color=${1:7}" ) && shift ;;
-no-share|--no-share) options=( "${options[@]}" "$noshare_opts" ) && shift ;;
-no-share|--no-share) options=( "${options[@]}" "${noshare_opts[@]}" ) && shift ;;
-no-global|--no-global) options=( "${options[@]}" "-Dsbt.global.base=$(pwd)/project/.sbtboot" ) && shift ;;
-sbt-boot|--sbt-boot) require_arg path "$1" "$2" && options=( "${options[@]}" "-Dsbt.boot.directory=$2" ) && shift 2 ;;
-sbt-dir|--sbt-dir) require_arg path "$1" "$2" && options=( "${options[@]}" "-Dsbt.global.base=$2" ) && shift 2 ;;