2023-01-27 02:34:46 +00:00
|
|
|
import java.util.stream.Collectors
|
|
|
|
|
2023-09-27 00:47:51 +00:00
|
|
|
def distDir = "${project.layout.buildDirectory.get()}/dist"
|
2023-01-27 02:34:46 +00:00
|
|
|
|
|
|
|
task licenses(type: DefaultTask) {
|
|
|
|
doLast {
|
|
|
|
copy {
|
|
|
|
from "$projectDir/licenses/"
|
|
|
|
into "$distDir/licenses/"
|
|
|
|
include '*.license'
|
|
|
|
rename { String name ->
|
|
|
|
name.replace("license", "txt")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
|
|
|
|
task baseDist(type: DefaultTask) {
|
|
|
|
doLast {
|
|
|
|
copy {
|
|
|
|
from "$distDir/jpackage/xpiped"
|
|
|
|
into "$distDir/base/app"
|
|
|
|
}
|
2023-02-05 15:04:18 +00:00
|
|
|
copy {
|
|
|
|
from "$projectDir/logo/logo.ico"
|
|
|
|
into "$distDir/base/app"
|
|
|
|
}
|
2023-12-31 05:05:03 +00:00
|
|
|
copy {
|
|
|
|
from "$projectDir/fonts"
|
|
|
|
into "$distDir/base/app/fonts"
|
|
|
|
}
|
2023-01-27 02:34:46 +00:00
|
|
|
|
|
|
|
def debugArguments = file("$projectDir/debug/debug_arguments.txt").text.lines().map(s -> '"' + s + '"').collect(Collectors.joining(
|
|
|
|
' '))
|
|
|
|
def debugAttachArguments = file("$projectDir/debug/windows/debug_attach_arguments.txt").text.lines().map(s -> '"' + s + '"').collect(
|
|
|
|
Collectors.joining(' '))
|
|
|
|
file("$distDir/base/app/scripts").mkdirs()
|
2023-08-20 01:43:14 +00:00
|
|
|
|
|
|
|
def debug = file("$distDir/base/app/scripts/xpiped_debug.bat")
|
2023-08-21 20:55:41 +00:00
|
|
|
debug.text = file("$projectDir/debug/windows/xpiped_debug.bat").text.replace(
|
2023-01-27 02:34:46 +00:00
|
|
|
'JVM-ARGS',
|
|
|
|
debugArguments)
|
2023-08-21 02:29:17 +00:00
|
|
|
debug.setExecutable(true)
|
2023-08-20 01:43:14 +00:00
|
|
|
|
|
|
|
def debugAttach = file("$distDir/base/app/scripts/xpiped_debug_attach.bat")
|
2023-08-21 20:55:41 +00:00
|
|
|
debugAttach.text = file("$projectDir/debug/windows/xpiped_debug.bat").text.replace(
|
2023-01-27 02:34:46 +00:00
|
|
|
'JVM-ARGS',
|
|
|
|
debugAttachArguments + ' ' + debugArguments)
|
2023-08-21 02:29:17 +00:00
|
|
|
debugAttach.setExecutable(true)
|
2023-01-27 02:34:46 +00:00
|
|
|
|
|
|
|
copy {
|
|
|
|
from "$distDir/cli"
|
|
|
|
into "$distDir/base/cli/bin"
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "$distDir/licenses"
|
|
|
|
into "$distDir/base/licenses"
|
|
|
|
}
|
2024-02-28 07:36:31 +00:00
|
|
|
copy {
|
|
|
|
from "$projectDir/bundled_bin/$platformName"
|
|
|
|
into "$distDir/base/app/bundled"
|
|
|
|
}
|
2023-01-27 02:34:46 +00:00
|
|
|
copy {
|
|
|
|
from "$distDir/docs/html5"
|
|
|
|
into "$distDir/base/cli/docs"
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rootProject.fullVersion) {
|
|
|
|
file("$distDir/base/app/xpiped.exe").writable = true
|
|
|
|
exec {
|
2023-10-18 07:10:15 +00:00
|
|
|
commandLine "$projectDir\\tools\\sign.bat", "$distDir/base/app/xpiped.exe"
|
|
|
|
ignoreExitValue = true
|
2023-01-27 02:34:46 +00:00
|
|
|
}
|
|
|
|
file("$distDir/base/app/xpiped.exe").writable = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (org.gradle.internal.os.OperatingSystem.current().isLinux()) {
|
|
|
|
task baseDist(type: DefaultTask) {
|
|
|
|
doLast {
|
|
|
|
copy {
|
|
|
|
from "$distDir/jpackage/xpiped"
|
|
|
|
into "$distDir/base/app"
|
|
|
|
}
|
2023-02-05 15:04:18 +00:00
|
|
|
copy {
|
|
|
|
from "$projectDir/logo/logo.png"
|
|
|
|
into "$distDir/base/"
|
|
|
|
}
|
2023-12-31 05:05:03 +00:00
|
|
|
copy {
|
|
|
|
from "$projectDir/fonts"
|
|
|
|
into "$distDir/base/app/fonts"
|
|
|
|
}
|
2023-01-27 02:34:46 +00:00
|
|
|
|
2023-02-05 15:04:18 +00:00
|
|
|
// Fixes a JPackage bug
|
2023-01-27 02:34:46 +00:00
|
|
|
copy {
|
|
|
|
from "$distDir/base/app/lib/app/xpiped.cfg"
|
|
|
|
into "$distDir/base/app"
|
|
|
|
}
|
|
|
|
|
|
|
|
def debugArguments = file("$projectDir/debug/debug_arguments.txt").text.lines().map(s -> '"' + s + '"').collect(Collectors.joining(
|
|
|
|
' '))
|
|
|
|
def debugAttachArguments = file("$projectDir/debug/linux/debug_attach_arguments.txt").text.lines().map(s -> '"' + s + '"').collect(
|
|
|
|
Collectors.joining(' '))
|
|
|
|
file("$distDir/base/app/scripts").mkdirs()
|
2023-08-21 02:29:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
def debug = file("$distDir/base/app/scripts/xpiped_debug.sh")
|
2023-08-21 20:55:41 +00:00
|
|
|
debug.text = file("$projectDir/debug/linux/xpiped_debug.sh").text.replace(
|
2023-01-27 02:34:46 +00:00
|
|
|
'JVM-ARGS',
|
|
|
|
debugArguments)
|
2023-08-21 02:29:17 +00:00
|
|
|
debug.setExecutable(true, false)
|
|
|
|
|
|
|
|
def debugAttach = file("$distDir/base/app/scripts/xpiped_debug_attach.sh")
|
2023-08-21 20:55:41 +00:00
|
|
|
debugAttach.text = file("$projectDir/debug/linux/xpiped_debug.sh").text.replace(
|
2023-01-27 02:34:46 +00:00
|
|
|
'JVM-ARGS',
|
|
|
|
debugAttachArguments + ' ' + debugArguments)
|
2023-08-21 02:29:17 +00:00
|
|
|
debugAttach.setExecutable(true, false)
|
2023-01-27 02:34:46 +00:00
|
|
|
|
|
|
|
copy {
|
|
|
|
from "$distDir/licenses"
|
|
|
|
into "$distDir/base/licenses"
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "$distDir/cli/xpipe"
|
|
|
|
into "$distDir/base/cli/bin"
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "$distDir/docs/html5"
|
|
|
|
into "$distDir/base/cli/docs"
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "$distDir/cli/xpipe_completion"
|
|
|
|
into "$distDir/base/cli"
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "$distDir/docs/manpage"
|
|
|
|
into "$distDir/base/cli/man"
|
|
|
|
}
|
2024-02-28 07:36:31 +00:00
|
|
|
copy {
|
|
|
|
from "$projectDir/bundled_bin/$platformName"
|
|
|
|
into "$distDir/base/app/bundled"
|
|
|
|
}
|
2023-01-27 02:34:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
task baseDist(type: DefaultTask) {
|
|
|
|
doLast {
|
2023-09-27 00:47:51 +00:00
|
|
|
def app = "${productName}.app"
|
2023-01-27 02:34:46 +00:00
|
|
|
copy {
|
|
|
|
from "$distDir/jpackage/xpiped.app/Contents"
|
2023-09-27 00:47:51 +00:00
|
|
|
into "$distDir/$app/Contents/"
|
2023-01-27 02:34:46 +00:00
|
|
|
}
|
2023-02-05 15:04:18 +00:00
|
|
|
copy {
|
|
|
|
from "$projectDir/logo/logo.icns"
|
2023-09-27 00:47:51 +00:00
|
|
|
into "$distDir/$app/Contents/Resources/"
|
2023-02-05 15:04:18 +00:00
|
|
|
}
|
2023-01-27 02:34:46 +00:00
|
|
|
copy {
|
|
|
|
from "$distDir/cli/xpipe"
|
2023-09-27 00:47:51 +00:00
|
|
|
into "$distDir/$app/Contents/MacOS/"
|
2023-01-27 02:34:46 +00:00
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "$distDir/licenses"
|
2023-09-27 00:47:51 +00:00
|
|
|
into "$distDir/$app/Contents/Resources/licenses"
|
2023-01-27 02:34:46 +00:00
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "$distDir/docs/html5"
|
2023-09-27 00:47:51 +00:00
|
|
|
into "$distDir/$app/Contents/Resources/cli/docs"
|
2023-01-27 02:34:46 +00:00
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "$distDir/docs/manpage"
|
2023-09-27 00:47:51 +00:00
|
|
|
into "$distDir/$app/Contents/Resources/cli/man"
|
2023-01-27 02:34:46 +00:00
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from "$distDir/cli/xpipe_completion"
|
2023-09-27 00:47:51 +00:00
|
|
|
into "$distDir/$app/Contents/Resources/cli/"
|
2023-01-27 02:34:46 +00:00
|
|
|
}
|
2023-12-31 05:05:03 +00:00
|
|
|
copy {
|
|
|
|
from "$projectDir/fonts"
|
|
|
|
into "$distDir/$app/Contents/Resources/fonts"
|
|
|
|
}
|
2024-02-28 07:36:31 +00:00
|
|
|
copy {
|
|
|
|
from "$projectDir/bundled_bin/$platformName"
|
|
|
|
into "$distDir/$app/Contents/Resources/bundled"
|
|
|
|
}
|
2023-01-27 02:34:46 +00:00
|
|
|
|
|
|
|
copy {
|
2023-05-04 19:02:31 +00:00
|
|
|
from "$projectDir/PkgInstaller/darwin/Resources/uninstall.sh"
|
2023-09-27 00:47:51 +00:00
|
|
|
into "$distDir/$app/Contents/Resources/scripts/"
|
2023-01-27 02:34:46 +00:00
|
|
|
}
|
2023-09-27 00:47:51 +00:00
|
|
|
file("$distDir/$app/Contents/Resources/scripts/uninstall.sh").text = file("$distDir/$app/Contents/Resources/scripts/uninstall.sh").text
|
|
|
|
.replaceAll("__PRODUCT__", productName)
|
2024-02-28 07:36:31 +00:00
|
|
|
.replaceAll("__PRODUCT_KEBAP__", kebapProductName)
|
|
|
|
.replaceAll("__VERSION__", versionString)
|
2023-01-27 02:34:46 +00:00
|
|
|
|
|
|
|
def debugArguments = file("$projectDir/debug/debug_arguments.txt").text.lines().map(s -> '"' + s + '"').collect(Collectors.joining(
|
|
|
|
' '))
|
|
|
|
def debugAttachArguments = file("$projectDir/debug/mac/debug_attach_arguments.txt").text.lines().map(s -> '"' + s + '"').collect(
|
|
|
|
Collectors.joining(' '))
|
2023-09-27 00:47:51 +00:00
|
|
|
file("$distDir/$app/Contents/Resources/scripts").mkdirs()
|
2023-08-21 02:29:17 +00:00
|
|
|
|
2023-09-27 00:47:51 +00:00
|
|
|
def debug = file("$distDir/$app/Contents/Resources/scripts/xpiped_debug.sh")
|
2023-08-21 20:55:41 +00:00
|
|
|
debug.text = file("$projectDir/debug/mac/xpiped_debug.sh").text.replace(
|
2023-01-27 02:34:46 +00:00
|
|
|
'JVM-ARGS',
|
|
|
|
debugArguments)
|
2023-08-21 02:29:17 +00:00
|
|
|
debug.setExecutable(true, false)
|
|
|
|
|
2023-09-27 00:47:51 +00:00
|
|
|
def debugAttach = file("$distDir/$app/Contents/Resources/scripts/xpiped_debug_attach.sh")
|
2023-08-21 20:55:41 +00:00
|
|
|
debugAttach.text = file("$projectDir/debug/mac/xpiped_debug.sh").text.replace(
|
2023-01-27 02:34:46 +00:00
|
|
|
'JVM-ARGS',
|
|
|
|
debugAttachArguments + ' ' + debugArguments)
|
2023-08-21 02:29:17 +00:00
|
|
|
debugAttach.setExecutable(true, false)
|
2023-01-27 02:34:46 +00:00
|
|
|
|
|
|
|
if (System.getenv("MACOS_DEVELOPER_ID_APPLICATION_CERTIFICATE_NAME") != null) {
|
|
|
|
exec {
|
2023-10-25 21:49:27 +00:00
|
|
|
commandLine "$projectDir/misc/mac/sign_and_notarize.sh", "$projectDir", rootProject.arch.toString(), rootProject.productName
|
2023-01-27 02:34:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
baseDist.dependsOn(licenses)
|
|
|
|
baseDist.dependsOn(jpackage)
|
|
|
|
dist.dependsOn(baseDist)
|