mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-29 11:00:32 +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.
225 lines
8.4 KiB
Groovy
225 lines
8.4 KiB
Groovy
import java.util.stream.Collectors
|
|
|
|
def distDir = "${project.layout.buildDirectory.get()}/dist"
|
|
|
|
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"
|
|
}
|
|
copy {
|
|
from "$projectDir/logo/logo.ico"
|
|
into "$distDir/base/app"
|
|
}
|
|
copy {
|
|
from "$projectDir/fonts"
|
|
into "$distDir/base/app/fonts"
|
|
}
|
|
|
|
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()
|
|
|
|
def debug = file("$distDir/base/app/scripts/xpiped_debug.bat")
|
|
debug.text = file("$projectDir/debug/windows/xpiped_debug.bat").text.replace(
|
|
'JVM-ARGS',
|
|
debugArguments)
|
|
debug.setExecutable(true)
|
|
|
|
def debugAttach = file("$distDir/base/app/scripts/xpiped_debug_attach.bat")
|
|
debugAttach.text = file("$projectDir/debug/windows/xpiped_debug.bat").text.replace(
|
|
'JVM-ARGS',
|
|
debugAttachArguments + ' ' + debugArguments)
|
|
debugAttach.setExecutable(true)
|
|
|
|
copy {
|
|
from "$distDir/cli"
|
|
into "$distDir/base/cli/bin"
|
|
}
|
|
copy {
|
|
from "$distDir/licenses"
|
|
into "$distDir/base/licenses"
|
|
}
|
|
copy {
|
|
from "$projectDir/bundled_bin/$platformName"
|
|
into "$distDir/base/app/bundled"
|
|
}
|
|
copy {
|
|
from "$distDir/docs/html5"
|
|
into "$distDir/base/cli/docs"
|
|
}
|
|
|
|
if (rootProject.fullVersion) {
|
|
file("$distDir/base/app/xpiped.exe").writable = true
|
|
exec {
|
|
commandLine "$projectDir\\tools\\sign.bat", "$distDir/base/app/xpiped.exe"
|
|
ignoreExitValue = true
|
|
}
|
|
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"
|
|
}
|
|
copy {
|
|
from "$projectDir/logo/logo.png"
|
|
into "$distDir/base/"
|
|
}
|
|
copy {
|
|
from "$projectDir/fonts"
|
|
into "$distDir/base/app/fonts"
|
|
}
|
|
|
|
// Fixes a JPackage bug
|
|
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()
|
|
|
|
|
|
def debug = file("$distDir/base/app/scripts/xpiped_debug.sh")
|
|
debug.text = file("$projectDir/debug/linux/xpiped_debug.sh").text.replace(
|
|
'JVM-ARGS',
|
|
debugArguments)
|
|
debug.setExecutable(true, false)
|
|
|
|
def debugAttach = file("$distDir/base/app/scripts/xpiped_debug_attach.sh")
|
|
debugAttach.text = file("$projectDir/debug/linux/xpiped_debug.sh").text.replace(
|
|
'JVM-ARGS',
|
|
debugAttachArguments + ' ' + debugArguments)
|
|
debugAttach.setExecutable(true, false)
|
|
|
|
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"
|
|
}
|
|
copy {
|
|
from "$projectDir/bundled_bin/$platformName"
|
|
into "$distDir/base/app/bundled"
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
task baseDist(type: DefaultTask) {
|
|
doLast {
|
|
def app = "${productName}.app"
|
|
copy {
|
|
from "$distDir/jpackage/xpiped.app/Contents"
|
|
into "$distDir/$app/Contents/"
|
|
}
|
|
copy {
|
|
from "$projectDir/logo/logo.icns"
|
|
into "$distDir/$app/Contents/Resources/"
|
|
}
|
|
copy {
|
|
from "$distDir/cli/xpipe"
|
|
into "$distDir/$app/Contents/MacOS/"
|
|
}
|
|
copy {
|
|
from "$distDir/licenses"
|
|
into "$distDir/$app/Contents/Resources/licenses"
|
|
}
|
|
copy {
|
|
from "$distDir/docs/html5"
|
|
into "$distDir/$app/Contents/Resources/cli/docs"
|
|
}
|
|
copy {
|
|
from "$distDir/docs/manpage"
|
|
into "$distDir/$app/Contents/Resources/cli/man"
|
|
}
|
|
copy {
|
|
from "$distDir/cli/xpipe_completion"
|
|
into "$distDir/$app/Contents/Resources/cli/"
|
|
}
|
|
copy {
|
|
from "$projectDir/fonts"
|
|
into "$distDir/$app/Contents/Resources/fonts"
|
|
}
|
|
copy {
|
|
from "$projectDir/bundled_bin/$platformName"
|
|
into "$distDir/$app/Contents/Resources/bundled"
|
|
}
|
|
|
|
copy {
|
|
from "$projectDir/PkgInstaller/darwin/Resources/uninstall.sh"
|
|
into "$distDir/$app/Contents/Resources/scripts/"
|
|
}
|
|
file("$distDir/$app/Contents/Resources/scripts/uninstall.sh").text = file("$distDir/$app/Contents/Resources/scripts/uninstall.sh").text
|
|
.replaceAll("__PRODUCT__", productName)
|
|
.replaceAll("__PRODUCT_KEBAP__", kebapProductName)
|
|
.replaceAll("__VERSION__", versionString)
|
|
|
|
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(' '))
|
|
file("$distDir/$app/Contents/Resources/scripts").mkdirs()
|
|
|
|
def debug = file("$distDir/$app/Contents/Resources/scripts/xpiped_debug.sh")
|
|
debug.text = file("$projectDir/debug/mac/xpiped_debug.sh").text.replace(
|
|
'JVM-ARGS',
|
|
debugArguments)
|
|
debug.setExecutable(true, false)
|
|
|
|
def debugAttach = file("$distDir/$app/Contents/Resources/scripts/xpiped_debug_attach.sh")
|
|
debugAttach.text = file("$projectDir/debug/mac/xpiped_debug.sh").text.replace(
|
|
'JVM-ARGS',
|
|
debugAttachArguments + ' ' + debugArguments)
|
|
debugAttach.setExecutable(true, false)
|
|
|
|
if (System.getenv("MACOS_DEVELOPER_ID_APPLICATION_CERTIFICATE_NAME") != null) {
|
|
exec {
|
|
commandLine "$projectDir/misc/mac/sign_and_notarize.sh", "$projectDir", rootProject.arch.toString(), rootProject.productName
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
baseDist.dependsOn(licenses)
|
|
baseDist.dependsOn(jpackage)
|
|
dist.dependsOn(baseDist)
|