Skip to content

Commit 617818d

Browse files
committed
Update deploy.gradle
1 parent b5a1ff5 commit 617818d

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

de.peeeq.wurstscript/deploy.gradle

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,41 @@ tasks.register("jlinkRuntime25") {
105105
def mods = modulesTxt.get().asFile.text.trim()
106106
def outDir = jreImageDir.get().asFile
107107

108+
if (!mods) throw new GradleException("No modules detected for jlink.")
108109
// jlink requires the output dir to NOT exist
109-
if (outDir.exists()) {
110-
project.delete(outDir)
111-
}
110+
if (outDir.exists()) project.delete(outDir)
112111
outDir.parentFile.mkdirs()
113112

114-
execOps.exec {
113+
logger.lifecycle("[jlink] Using: ${jlink}")
114+
logger.lifecycle("[jlink] Modules: ${mods}")
115+
116+
def errBuf = new ByteArrayOutputStream()
117+
def outBuf = new ByteArrayOutputStream()
118+
def result = execOps.exec {
115119
commandLine jlink,
120+
"--verbose",
116121
"--add-modules", mods,
117122
"--no-header-files",
118123
"--no-man-pages",
119124
"--strip-debug",
120125
"--compress", "zip-6",
121126
"--output", outDir.absolutePath
127+
errorOutput = errBuf
128+
standardOutput = outBuf
129+
ignoreExitValue = true
122130
}
131+
132+
if (result.exitValue != 0) {
133+
logger.lifecycle("[jlink][stdout]\n${outBuf.toString()}")
134+
logger.error("[jlink][stderr]\n${errBuf.toString()}")
135+
throw new GradleException("jlink failed with exit ${result.exitValue}")
136+
}
137+
123138
logger.lifecycle("[jlink] Runtime created at: ${outDir}")
124139
}
125140
}
126141

142+
127143
// 3) Assemble folder layout: jre + compiler.jar (no manifest)
128144
tasks.register("assembleSlimCompilerDist", Copy) {
129145
description = "Assembles dist folder with slim JRE and compiler.jar (no manifest)."

0 commit comments

Comments
 (0)