mirror of
https://github.com/enso-org/enso.git
synced 2024-11-29 17:22:57 +03:00
Pass arguments to native-image via argfile
This commit is contained in:
parent
6a9fff2d55
commit
ba0a69de6e
@ -40,6 +40,8 @@ object NativeImage {
|
||||
"ch.qos.logback"
|
||||
)
|
||||
|
||||
val NATIVE_IMAGE_ARG_FILE = "native-image-args.txt"
|
||||
|
||||
/** Creates a task that builds a native image for the current project.
|
||||
*
|
||||
* This task must be setup in such a way that the assembly JAR is built
|
||||
@ -193,9 +195,7 @@ object NativeImage {
|
||||
|
||||
val verboseOpt = if (verbose) Seq("--verbose") else Seq()
|
||||
|
||||
var cmd: Seq[String] =
|
||||
Seq(nativeImagePath) ++
|
||||
verboseOpt ++
|
||||
var args: Seq[String] =
|
||||
Seq("-cp", cpStr) ++
|
||||
quickBuildOption ++
|
||||
debugParameters ++ staticParameters ++ configs ++
|
||||
@ -208,18 +208,27 @@ object NativeImage {
|
||||
additionalOptions ++
|
||||
Seq("-o", artifactName)
|
||||
|
||||
cmd = mainClass match {
|
||||
args = mainClass match {
|
||||
case Some(main) =>
|
||||
cmd ++
|
||||
args ++
|
||||
Seq(main)
|
||||
case None =>
|
||||
cmd ++
|
||||
args ++
|
||||
Seq("-jar", pathToJAR.toString)
|
||||
}
|
||||
|
||||
val targetDir = (Compile / target).value
|
||||
val argFile = targetDir.toPath.resolve(NATIVE_IMAGE_ARG_FILE)
|
||||
IO.writeLines(argFile.toFile, args, append = false)
|
||||
|
||||
val pathParts = pathExts ++ Option(System.getenv("PATH")).toSeq
|
||||
val newPath = pathParts.mkString(File.pathSeparator)
|
||||
|
||||
val cmd =
|
||||
Seq(nativeImagePath) ++
|
||||
verboseOpt ++
|
||||
Seq("@" + argFile.toAbsolutePath.toString)
|
||||
|
||||
log.debug(s"""PATH="$newPath" ${cmd.mkString(" ")}""")
|
||||
|
||||
val process =
|
||||
|
Loading…
Reference in New Issue
Block a user