107 lines
3.8 KiB
Plaintext
107 lines
3.8 KiB
Plaintext
plugins {
|
|
id("inceptum.application-standalone")
|
|
id("org.beryx.jlink") version "2.26.0"
|
|
}
|
|
|
|
application {
|
|
mainClass.set("io.gitlab.jfronny.inceptum.Inceptum")
|
|
applicationName = "Inceptum"
|
|
}
|
|
|
|
dependencies {
|
|
implementation(project(":launcher"))
|
|
implementation(project(":launcher-cli"))
|
|
implementation(project(":launcher-imgui"))
|
|
}
|
|
|
|
tasks.shadowJar {
|
|
archiveClassifier.set(rootProject.extra["flavorProp"] as String)
|
|
archiveBaseName.set("Inceptum")
|
|
exclude("about.html")
|
|
exclude("plugin.properties")
|
|
exclude("META-INF/**")
|
|
}
|
|
|
|
(components["java"] as AdhocComponentWithVariants).withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
|
|
skip()
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
create<MavenPublication>("mavenJava") {
|
|
from(components["java"])
|
|
}
|
|
}
|
|
}
|
|
|
|
val flavor: String by rootProject.extra
|
|
val os = org.gradle.internal.os.OperatingSystem.current()!!
|
|
val crosscompile = flavor == "windows" && os.isLinux && project.hasProperty("crosscompile")
|
|
|
|
val verifyFlavorConfiguration by tasks.registering {
|
|
when (flavor) {
|
|
"macos" -> if (!os.isMacOsX) throw IllegalArgumentException("Cross-compilation to MacOS is unsupported!")
|
|
"windows" -> if (!os.isWindows && !crosscompile) {
|
|
if (os.isLinux) throw IllegalArgumentException("Cross-compilation to Windows is not enabled, please do so to build this")
|
|
else throw IllegalArgumentException("Cross-compilation to Windows from this platform is unsupported!")
|
|
}
|
|
"linux" -> if (!os.isLinux) throw IllegalArgumentException("Cross-compilation to Linux is unsupported!")
|
|
else -> throw IllegalArgumentException("Unexpected flavor: $flavor")
|
|
}
|
|
}
|
|
|
|
tasks.prepareMergedJarsDir { dependsOn(verifyFlavorConfiguration) }
|
|
tasks.createMergedModule { dependsOn(verifyFlavorConfiguration) }
|
|
tasks.createDelegatingModules { dependsOn(verifyFlavorConfiguration) }
|
|
tasks.prepareModulesDir { dependsOn(verifyFlavorConfiguration) }
|
|
tasks.jlink { dependsOn(verifyFlavorConfiguration) }
|
|
tasks.jlinkZip { dependsOn(verifyFlavorConfiguration) }
|
|
tasks.suggestMergedModuleInfo { dependsOn(verifyFlavorConfiguration) }
|
|
tasks.jpackageImage { dependsOn(verifyFlavorConfiguration) }
|
|
tasks.jpackage { dependsOn(verifyFlavorConfiguration) }
|
|
|
|
if (crosscompile) System.setProperty("badass.jlink.jpackage.home", "/root/jpackage-win")
|
|
jlink {
|
|
if (crosscompile) javaHome.set("/root/jpackage-win")
|
|
addOptions(
|
|
"--strip-debug",
|
|
"--compress", "2",
|
|
"--no-header-files",
|
|
"--no-man-pages",
|
|
"--verbose"
|
|
)
|
|
launcher {
|
|
name = application.applicationName
|
|
}
|
|
if (crosscompile) targetPlatform("win", "/root/java")
|
|
jpackage {
|
|
imageName = application.applicationName
|
|
// vendor
|
|
when (flavor) {
|
|
"macos" -> {
|
|
installerType = "app-image"
|
|
installerOptions.addAll(listOf(
|
|
"--mac-package-name", "inceptum"
|
|
))
|
|
}
|
|
"windows" -> {
|
|
installerType = "msi"
|
|
installerOptions.addAll(listOf(
|
|
"--win-per-user-install",
|
|
"--win-dir-chooser",
|
|
"--win-menu",
|
|
"--win-upgrade-uuid", "180becd8-a867-40d4-86ef-20949cae68b5" // Update this UUID if you fork the project!!!
|
|
))
|
|
//imageOptions.add("--win-console") // Enable this for debugging
|
|
}
|
|
else -> {
|
|
// might also be able to push rpm with appropriate image
|
|
installerType = "deb"
|
|
installerOptions.addAll(listOf(
|
|
"--linux-package-name", "inceptum",
|
|
"--linux-shortcut"
|
|
))
|
|
}
|
|
}
|
|
}
|
|
} |