From d0e9e41ca9ba3e7a649d20a149278b59f7c02f12 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Mon, 30 Apr 2018 00:02:02 +0200 Subject: [PATCH] Actually pass Java options to bootstraps --- cli/src/main/scala-2.12/coursier/cli/Bootstrap.scala | 2 +- scripts/travis.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cli/src/main/scala-2.12/coursier/cli/Bootstrap.scala b/cli/src/main/scala-2.12/coursier/cli/Bootstrap.scala index a5eba41f5..9ad4555c5 100644 --- a/cli/src/main/scala-2.12/coursier/cli/Bootstrap.scala +++ b/cli/src/main/scala-2.12/coursier/cli/Bootstrap.scala @@ -200,7 +200,7 @@ object Bootstrap extends CaseApp[BootstrapOptions] { // escaping of javaOpt possibly a bit loose :-| val shellPreamble = Seq( "#!/usr/bin/env sh", - "exec java -jar " + options.options.javaOpt.map(s => "'" + s.replace("'", "\\'") + "'").mkString(" ") + " \"$0\" \"$@\"" + "exec java " + options.options.javaOpt.map(s => "'" + s.replace("'", "\\'") + "'").mkString(" ") + " -jar \"$0\" \"$@\"" ).mkString("", "\n", "\n") try Files.write(output0.toPath, shellPreamble.getBytes(UTF_8) ++ buffer.toByteArray) diff --git a/scripts/travis.sh b/scripts/travis.sh index f763fde8d..1f2ac28ac 100755 --- a/scripts/travis.sh +++ b/scripts/travis.sh @@ -135,6 +135,15 @@ testBootstrap() { echo "Error: unexpected output from bootstrapped echo command (generated by proguarded launcher)." 1>&2 exit 1 fi + + # run via the launcher rather than via the sbt-pack scripts, because the latter interprets -Dfoo=baz itself + # rather than passing it to coursier since https://github.com/xerial/sbt-pack/pull/118 + ./coursier-test bootstrap -o cs-props -J -Dfoo=baz io.get-coursier:props:1.0.2 + local OUT="$(./cs-props foo)" + if [ "$OUT" != baz ]; then + echo -e "Error: unexpected output from bootstrapped props command.\n$OUT" 1>&2 + exit 1 + fi fi }