Skip to content

Commit 5b436c7

Browse files
author
Martin Vehovsky
committed
simplify gradle build script for '--package' as gradle-capsule-plugin already supports 'reallyExecutable'
1 parent 8e272a0 commit 5b436c7

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

src/main/kotlin/kscript/app/AppHelpers.kt

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -316,37 +316,18 @@ $stringifiedDeps
316316
compile files('${scriptJar.invariantSeparatorsPath}')
317317
}
318318
319-
// http://www.capsule.io/user-guide/#really-executable-capsules
320-
def reallyExecutable(jar) {
321-
ant.concat(destfile: "tmp.jar", binary: true) {
322-
//zipentry(zipfile: configurations.capsule.singleFile, name: 'capsule/execheader.sh')
323-
fileset(dir: '.', includes: 'exec_header.sh')
324-
325-
fileset(dir: jar.destinationDir) {
326-
include(name: jar.archiveName)
327-
}
328-
}
329-
copy {
330-
from 'tmp.jar'
331-
into jar.destinationDir
332-
rename { jar.archiveName }
333-
}
334-
delete 'tmp.jar'
335-
}
336-
337319
task simpleCapsule(type: FatCapsule){
338320
applicationClass '$wrapperClassName'
339321
340-
baseName '$appName'
322+
archiveName '$appName'
323+
reallyExecutable
341324
342325
capsuleManifest {
343326
jvmArgs = [$jvmOptions]
344327
//args = []
345328
//systemProperties['java.awt.headless'] = true
346329
}
347330
}
348-
349-
simpleCapsule.doLast { task -> reallyExecutable(task) }
350331
""".trimIndent()
351332

352333
val pckgedJar = File(Paths.get("").toAbsolutePath().toFile(), appName).absoluteFile
@@ -367,7 +348,7 @@ exec java -jar ${'$'}0 "${'$'}@"
367348
}
368349

369350
pckgedJar.delete()
370-
File(tmpProjectDir, "build/libs/${appName}-capsule.jar").copyTo(pckgedJar, true)
351+
File(tmpProjectDir, "build/libs/${appName}").copyTo(pckgedJar, true)
371352

372353
infoMsg("Finished packaging into ${pckgedJar}")
373354
}

0 commit comments

Comments
 (0)