2024-02-28 20:36:31 +13:00
|
|
|
apply from: "$rootDir/gradle/gradle_scripts/javafx.gradle"
|
2024-03-25 21:15:31 +13:00
|
|
|
apply from: "$rootDir/gradle/gradle_scripts/jna.gradle"
|
2023-01-27 15:34:46 +13:00
|
|
|
|
2023-09-27 13:47:51 +13:00
|
|
|
def distDir = "${project.layout.buildDirectory.get()}/dist"
|
2023-01-27 15:34:46 +13:00
|
|
|
|
2023-10-16 16:37:22 +13:00
|
|
|
def distJvmArgs = new ArrayList<String>(project(':app').jvmRunArgs)
|
2023-01-27 15:34:46 +13:00
|
|
|
|
|
|
|
def releaseArguments = distJvmArgs + [
|
2023-06-12 13:08:43 +12:00
|
|
|
"-Dio.xpipe.app.version=$rootProject.versionString",
|
|
|
|
"-Dio.xpipe.app.build=$rootProject.versionString-${new Date().format('yyyyMMddHHmm')}",
|
2023-02-11 02:46:54 +13:00
|
|
|
"-Dio.xpipe.app.buildId=$rootProject.buildId",
|
2023-02-20 06:44:47 +13:00
|
|
|
"-Dio.xpipe.app.fullVersion=$rootProject.fullVersion",
|
2023-04-27 02:34:59 +12:00
|
|
|
"-Dio.xpipe.app.staging=$rootProject.isStage",
|
2024-03-25 21:15:31 +13:00
|
|
|
'-Dio.xpipe.app.sentryUrl=https://fd5f67ff10764b7e8a704bec9558c8fe@o1084459.ingest.sentry.io/6094279',
|
|
|
|
'-Djna.nosys=false',
|
|
|
|
'-Djna.nounpack=true'
|
2023-01-27 15:34:46 +13:00
|
|
|
]
|
|
|
|
|
|
|
|
if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
|
2023-05-21 02:23:36 +12:00
|
|
|
releaseArguments += '-Xdock:name=XPipe'
|
2023-01-27 15:34:46 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
// To remove warnings, the plugin probably does not expect the JPackage tasks to be in a separate project
|
|
|
|
application {
|
|
|
|
mainModule = 'io.xpipe.app'
|
|
|
|
mainClass = 'io.xpipe.app.Main'
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2024-02-28 20:36:31 +13:00
|
|
|
implementation project(':app')
|
|
|
|
if (!useBundledJavaFx) {
|
|
|
|
configurations.javafx.getAsFileTree().getFiles().forEach {
|
|
|
|
implementation files(it)
|
|
|
|
}
|
|
|
|
}
|
2024-03-25 21:15:31 +13:00
|
|
|
if (!useBundledJavaFx) {
|
|
|
|
configurations.jna.getAsFileTree().getFiles().forEach {
|
|
|
|
implementation files(it)
|
|
|
|
}
|
|
|
|
}
|
2023-01-27 15:34:46 +13:00
|
|
|
}
|
|
|
|
|
2023-08-20 21:42:34 +12:00
|
|
|
// Mac does not like a zero major version
|
|
|
|
def macVersion = rootProject.canonicalVersionString
|
|
|
|
if (Integer.parseInt(macVersion.substring(0, 1)) == 0) {
|
|
|
|
macVersion = "1" + macVersion.substring(1)
|
|
|
|
}
|
|
|
|
|
2023-01-27 15:34:46 +13:00
|
|
|
jlink {
|
2023-09-27 13:47:51 +13:00
|
|
|
imageDir = file("${project.layout.buildDirectory.get()}/image")
|
2023-01-27 15:34:46 +13:00
|
|
|
options = [
|
|
|
|
// Disable this as this removes line numbers from stack traces!
|
|
|
|
// '--strip-debug',
|
|
|
|
'--no-header-files',
|
|
|
|
'--no-man-pages',
|
2024-05-27 08:33:30 +12:00
|
|
|
'--include-locales', "${String.join(",", languages)}",
|
|
|
|
'--compress', 'zip-9'
|
2023-01-27 15:34:46 +13:00
|
|
|
]
|
|
|
|
|
2024-05-27 08:33:30 +12:00
|
|
|
if (org.gradle.internal.os.OperatingSystem.current().isLinux()) {
|
2024-06-15 22:40:03 +12:00
|
|
|
options.addAll('--strip-native-debug-symbols', 'exclude-debuginfo-files')
|
2024-05-27 08:33:30 +12:00
|
|
|
}
|
|
|
|
|
2024-02-28 20:36:31 +13:00
|
|
|
if (useBundledJavaFx) {
|
|
|
|
addExtraModulePath(layout.projectDirectory.dir("javafx/${platformName}/${arch}").toString())
|
2024-01-16 10:05:14 +13:00
|
|
|
}
|
2024-03-25 21:15:31 +13:00
|
|
|
if (useBundledJna) {
|
|
|
|
addExtraModulePath(layout.projectDirectory.dir("jna/${platformName}/${arch}").toString())
|
|
|
|
}
|
2023-10-25 08:01:38 +13:00
|
|
|
|
2023-01-27 15:34:46 +13:00
|
|
|
launcher {
|
|
|
|
moduleName = 'io.xpipe.app'
|
|
|
|
mainClassName = 'io.xpipe.app.Main'
|
|
|
|
name = 'xpiped'
|
|
|
|
jvmArgs = releaseArguments
|
|
|
|
}
|
|
|
|
|
|
|
|
jpackage {
|
|
|
|
imageOutputDir = file("$distDir/jpackage")
|
|
|
|
imageName = 'xpiped'
|
|
|
|
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
|
|
|
|
icon = "logo/logo.ico"
|
2023-02-03 02:58:50 +13:00
|
|
|
appVersion = rootProject.canonicalVersionString
|
2023-01-27 15:34:46 +13:00
|
|
|
} else if (org.gradle.internal.os.OperatingSystem.current().isLinux()) {
|
|
|
|
icon = "logo/logo.png"
|
2023-02-03 02:58:50 +13:00
|
|
|
appVersion = rootProject.canonicalVersionString
|
2023-01-27 15:34:46 +13:00
|
|
|
} else {
|
|
|
|
icon = "logo/logo.icns"
|
2023-09-27 13:47:51 +13:00
|
|
|
resourceDir = file("${project.layout.buildDirectory.get()}/macos_resources")
|
2023-08-20 21:42:34 +12:00
|
|
|
appVersion = macVersion
|
2023-01-27 15:34:46 +13:00
|
|
|
}
|
|
|
|
skipInstaller = true
|
2023-05-21 02:23:36 +12:00
|
|
|
applicationName = 'XPipe'
|
2023-01-27 15:34:46 +13:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.named('jlink').get().dependsOn(rootProject.getTasksByName("jar", true))
|
|
|
|
|
|
|
|
def outputName = org.gradle.internal.os.OperatingSystem.current().isMacOsX() ? 'xpiped.app/Contents/Resources' : 'xpiped'
|
2023-04-05 04:11:31 +12:00
|
|
|
def extModules = project.allExtensions.toList()
|
2023-02-11 02:46:54 +13:00
|
|
|
task copyBundledExtensions(type: DefaultTask,
|
|
|
|
dependsOn: extModules.stream().map { it.getTasksByName('createExtOutput', true)[0] }.toList()) {
|
2023-01-27 15:34:46 +13:00
|
|
|
doLast {
|
2023-02-11 02:46:54 +13:00
|
|
|
for (def extProject : extModules) {
|
|
|
|
def dir = "${extProject.buildDir}/libs_ext"
|
2023-01-27 15:34:46 +13:00
|
|
|
if (file(dir).exists()) {
|
|
|
|
copy {
|
|
|
|
from(dir)
|
|
|
|
into "$distDir/jpackage/$outputName/extensions/${extProject.name}"
|
|
|
|
include '*.jar'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-08-20 18:51:17 +12:00
|
|
|
|
|
|
|
task prepareMacOSInfo(type: DefaultTask) {
|
|
|
|
doLast {
|
2023-09-27 13:47:51 +13:00
|
|
|
file("${project.layout.buildDirectory.get()}/macos_resources").mkdirs()
|
2023-08-20 18:51:17 +12:00
|
|
|
copy {
|
2023-09-27 13:47:51 +13:00
|
|
|
from replaceVariablesInFile("$projectDir/misc/mac/Info.plist",
|
|
|
|
Map.of('__NAME__',
|
|
|
|
rootProject.productName,
|
|
|
|
'__VERSION__',
|
|
|
|
rootProject.versionString,
|
|
|
|
'__BUNDLE__',
|
|
|
|
rootProject.isStage ? 'io.xpipe.ptb-app' : 'io.xpipe.app'))
|
|
|
|
into file("${project.layout.buildDirectory.get()}/macos_resources")
|
2023-08-20 18:51:17 +12:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
|
2023-08-20 21:42:34 +12:00
|
|
|
jpackageImage.dependsOn(prepareMacOSInfo)
|
2023-08-20 18:51:17 +12:00
|
|
|
}
|
|
|
|
|
2023-01-27 15:34:46 +13:00
|
|
|
jpackage.finalizedBy(copyBundledExtensions)
|