mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 07:30:24 +00:00
3e7fbe89ac
The changes have been squashed as the commit history and messages were not very carefully crafted. There isn't that much value in preserving random commit messages. Also due to diverging branches, rebasing or merging it was difficult.
121 lines
4.3 KiB
Groovy
121 lines
4.3 KiB
Groovy
apply from: "$rootDir/gradle/gradle_scripts/javafx.gradle"
|
|
|
|
def distDir = "${project.layout.buildDirectory.get()}/dist"
|
|
|
|
def distJvmArgs = new ArrayList<String>(project(':app').jvmRunArgs)
|
|
|
|
def releaseArguments = distJvmArgs + [
|
|
"-Dio.xpipe.app.version=$rootProject.versionString",
|
|
"-Dio.xpipe.app.build=$rootProject.versionString-${new Date().format('yyyyMMddHHmm')}",
|
|
"-Dio.xpipe.app.buildId=$rootProject.buildId",
|
|
"-Dio.xpipe.app.fullVersion=$rootProject.fullVersion",
|
|
"-Dio.xpipe.app.staging=$rootProject.isStage",
|
|
'-Dio.xpipe.app.sentryUrl=https://fd5f67ff10764b7e8a704bec9558c8fe@o1084459.ingest.sentry.io/6094279'
|
|
]
|
|
|
|
if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
|
|
releaseArguments += '-Xdock:name=XPipe'
|
|
}
|
|
|
|
// 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 {
|
|
implementation project(':app')
|
|
if (!useBundledJavaFx) {
|
|
configurations.javafx.getAsFileTree().getFiles().forEach {
|
|
implementation files(it)
|
|
}
|
|
}
|
|
}
|
|
|
|
// 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)
|
|
}
|
|
|
|
jlink {
|
|
imageDir = file("${project.layout.buildDirectory.get()}/image")
|
|
options = [
|
|
// Disable this as this removes line numbers from stack traces!
|
|
// '--strip-debug',
|
|
'--no-header-files',
|
|
'--no-man-pages',
|
|
// '--strip-native-commands'
|
|
]
|
|
|
|
if (useBundledJavaFx) {
|
|
addExtraModulePath(layout.projectDirectory.dir("javafx/${platformName}/${arch}").toString())
|
|
}
|
|
|
|
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"
|
|
appVersion = rootProject.canonicalVersionString
|
|
} else if (org.gradle.internal.os.OperatingSystem.current().isLinux()) {
|
|
icon = "logo/logo.png"
|
|
appVersion = rootProject.canonicalVersionString
|
|
} else {
|
|
icon = "logo/logo.icns"
|
|
resourceDir = file("${project.layout.buildDirectory.get()}/macos_resources")
|
|
appVersion = macVersion
|
|
}
|
|
skipInstaller = true
|
|
applicationName = 'XPipe'
|
|
}
|
|
}
|
|
|
|
tasks.named('jlink').get().dependsOn(rootProject.getTasksByName("jar", true))
|
|
|
|
def outputName = org.gradle.internal.os.OperatingSystem.current().isMacOsX() ? 'xpiped.app/Contents/Resources' : 'xpiped'
|
|
def extModules = project.allExtensions.toList()
|
|
task copyBundledExtensions(type: DefaultTask,
|
|
dependsOn: extModules.stream().map { it.getTasksByName('createExtOutput', true)[0] }.toList()) {
|
|
doLast {
|
|
for (def extProject : extModules) {
|
|
def dir = "${extProject.buildDir}/libs_ext"
|
|
if (file(dir).exists()) {
|
|
copy {
|
|
from(dir)
|
|
into "$distDir/jpackage/$outputName/extensions/${extProject.name}"
|
|
include '*.jar'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
task prepareMacOSInfo(type: DefaultTask) {
|
|
doLast {
|
|
file("${project.layout.buildDirectory.get()}/macos_resources").mkdirs()
|
|
copy {
|
|
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")
|
|
}
|
|
}
|
|
}
|
|
|
|
if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
|
|
jpackageImage.dependsOn(prepareMacOSInfo)
|
|
}
|
|
|
|
jpackage.finalizedBy(copyBundledExtensions)
|