make jpackageZip work on Linux
Note: using @incubating useFileSystemPermissions() Note: type = ImageType.DEFAULT not working on Linux, using APP_IMAGE, even if it creates a zip file (?)
This commit is contained in:
@@ -3,6 +3,7 @@ import org.gradle.internal.os.OperatingSystem
|
|||||||
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
|
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||||
|
import org.panteleyev.jpackage.ImageType
|
||||||
|
|
||||||
group = "org.openrndr.template"
|
group = "org.openrndr.template"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@@ -205,45 +206,63 @@ tasks {
|
|||||||
tasks {
|
tasks {
|
||||||
named("jpackage") {
|
named("jpackage") {
|
||||||
doLast {
|
doLast {
|
||||||
val destPath = if (OperatingSystem.current().isMacOsX)
|
val destPath = "build/jpackage/" + if (OperatingSystem.current().isMacOsX)
|
||||||
"build/jpackage/openrndr-application.app/Contents/Resources/data"
|
"openrndr-application.app/Contents/Resources/data"
|
||||||
else
|
else
|
||||||
"build/jpackage/openrndr-application/data"
|
"openrndr-application/data"
|
||||||
|
|
||||||
copy {
|
copy {
|
||||||
from("data") {
|
from("data") { include("**/*") }
|
||||||
include("**/*")
|
|
||||||
}
|
|
||||||
into(destPath)
|
into(destPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------------------------ //
|
|
||||||
|
|
||||||
register<Zip>("jpackageZip") {
|
register<Zip>("jpackageZip") {
|
||||||
archiveFileName = "openrndr-application.zip"
|
archiveFileName = "openrndr-application.zip"
|
||||||
from("${layout.buildDirectory.get()}/jpackage") {
|
from("${layout.buildDirectory.get()}/jpackage") {
|
||||||
include("**/*")
|
include("**/*")
|
||||||
}
|
}
|
||||||
|
isPreserveFileTimestamps = true
|
||||||
|
isReproducibleFileOrder = true
|
||||||
|
useFileSystemPermissions()
|
||||||
dependsOn("jpackage")
|
dependsOn("jpackage")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------------------------ //
|
// ------------------------------------------------------------------------------------------------------------------ //
|
||||||
|
|
||||||
runtime {
|
tasks.register("copyDependencies", Copy::class) {
|
||||||
jpackage {
|
from(configurations.runtimeClasspath).into(layout.buildDirectory.dir("jars"))
|
||||||
imageName = "openrndr-application"
|
}
|
||||||
skipInstaller = true
|
|
||||||
if (OperatingSystem.current().isMacOsX) {
|
tasks.register("copyJar", Copy::class) {
|
||||||
jvmArgs.add("-XstartOnFirstThread")
|
from(tasks.jar).into(layout.buildDirectory.dir("jars"))
|
||||||
jvmArgs.add($$"-Duser.dir=$APPDIR/../Resources")
|
}
|
||||||
}
|
|
||||||
|
tasks.jpackage {
|
||||||
|
dependsOn("build", "copyDependencies", "copyJar")
|
||||||
|
|
||||||
|
appName = "openrndr-application"
|
||||||
|
mac {
|
||||||
|
javaOptions = listOf(
|
||||||
|
"-XstartOnFirstThread",
|
||||||
|
$$"-Duser.dir=$APPDIR/../Resources"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
options = listOf("--strip-debug", "--compress", "1", "--no-header-files", "--no-man-pages")
|
windows {
|
||||||
modules = listOf("jdk.unsupported", "java.management", "java.desktop")
|
}
|
||||||
|
linux {
|
||||||
|
type = ImageType.APP_IMAGE
|
||||||
|
}
|
||||||
|
input = layout.buildDirectory.dir("jars")
|
||||||
|
destination = layout.buildDirectory.dir("jpackage")
|
||||||
|
|
||||||
|
mainJar = tasks.jar.get().archiveFileName.get()
|
||||||
|
mainClass = applicationMainClass
|
||||||
|
|
||||||
|
addModules = listOf("jdk.unsupported", "java.management", "java.desktop")
|
||||||
|
jLinkOptions = listOf("--strip-debug", "--compress", "1", "--no-header-files", "--no-man-pages")
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------------------------ //
|
// ------------------------------------------------------------------------------------------------------------------ //
|
||||||
|
|||||||
Reference in New Issue
Block a user