Allow to specify Java options in the generated bootstraps

This commit is contained in:
Alexandre Archambault 2016-02-24 20:42:13 +01:00
parent 60f4d3b61d
commit 0b38b0bc00
1 changed files with 6 additions and 2 deletions

View File

@ -375,6 +375,10 @@ case class Bootstrap(
@Value("key=value")
@Short("P")
property: List[String],
@Help("Set Java command-line options in the generated launcher.")
@Value("option")
@Short("J")
javaOpt: List[String],
@Recurse
isolated: IsolatedLoaderOptions,
@Recurse
@ -552,10 +556,10 @@ case class Bootstrap(
outputZip.close()
// escaping of javaOpt possibly a bit loose :-|
val shellPreamble = Seq(
"#!/usr/bin/env sh",
"exec java -jar \"$0\" \"$@\""
"exec java -jar " + javaOpt.map(s => "'" + s.replace("'", "\\'") + "'").mkString(" ") + " \"$0\" \"$@\""
).mkString("", "\n", "\n")
try NIOFiles.write(output0.toPath, shellPreamble.getBytes("UTF-8") ++ buffer.toByteArray)