mirror of https://github.com/sbt/sbt.git
Allow proguarded jar to be launched straightaway
With the right bash header
This commit is contained in:
parent
23ea3ff6fa
commit
11a1e509b5
11
build.sbt
11
build.sbt
|
|
@ -230,6 +230,17 @@ lazy val cli = project
|
||||||
},
|
},
|
||||||
packExcludeArtifactTypes += "pom",
|
packExcludeArtifactTypes += "pom",
|
||||||
resourceGenerators in Compile += packageBin.in(bootstrap).in(Compile).map { jar =>
|
resourceGenerators in Compile += packageBin.in(bootstrap).in(Compile).map { jar =>
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.nio.charset.StandardCharsets
|
||||||
|
|
||||||
|
val content = Files.readAllBytes(jar.toPath)
|
||||||
|
val header =
|
||||||
|
"""#!/usr/bin/env sh
|
||||||
|
|exec java $JAVA_OPTS -noverify -jar "$0" "$@"
|
||||||
|
""".stripMargin
|
||||||
|
|
||||||
|
Files.write(jar.toPath, header.getBytes(StandardCharsets.UTF_8) ++ content)
|
||||||
|
|
||||||
Seq(jar)
|
Seq(jar)
|
||||||
}.taskValue,
|
}.taskValue,
|
||||||
ProguardKeys.proguardVersion in Proguard := "5.3",
|
ProguardKeys.proguardVersion in Proguard := "5.3",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue