mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-02 02:31:21 +12:00
193 lines
7.8 KiB
Groovy
193 lines
7.8 KiB
Groovy
import java.util.stream.Collectors
|
|
|
|
def distDir = "$buildDir/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"
|
|
}
|
|
|
|
file("$distDir/base/app/xpiped.exe").writable = true
|
|
exec {
|
|
commandLine 'cmd',
|
|
'/c',
|
|
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat",
|
|
'&',
|
|
"signtool.exe",
|
|
'sign',
|
|
'/f',
|
|
"$projectDir\\misc\\windows\\certificate.cer",
|
|
'/fd',
|
|
'sha256',
|
|
'/tr',
|
|
'http://timestamp.digicert.com',
|
|
'/td',
|
|
'sha256',
|
|
'/v',
|
|
'/as',
|
|
"$distDir/base/app/xpiped.exe"
|
|
ignoreExitValue = true
|
|
}
|
|
|
|
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()
|
|
file("$distDir/base/app/scripts/xpiped_debug.bat").text = file("$projectDir/debug/windows/xpiped_debug.bat").text.replaceAll(
|
|
'JVM-ARGS',
|
|
debugArguments)
|
|
file("$distDir/base/app/scripts/xpiped_debug_attach.bat").text = file("$projectDir/debug/windows/xpiped_debug.bat").text.replaceAll(
|
|
'JVM-ARGS',
|
|
debugAttachArguments + ' ' + debugArguments)
|
|
|
|
copy {
|
|
from "$distDir/cli"
|
|
into "$distDir/base/cli/bin"
|
|
}
|
|
copy {
|
|
from "$distDir/licenses"
|
|
into "$distDir/base/licenses"
|
|
}
|
|
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_desktop.bat"
|
|
}
|
|
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 "$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()
|
|
file("$distDir/base/app/scripts/xpiped_debug.sh").text = file("$projectDir/debug/linux/xpiped_debug.sh").text.replace(
|
|
'JVM-ARGS',
|
|
debugArguments)
|
|
file("$distDir/base/app/scripts/xpiped_debug.sh").executable = true
|
|
file("$distDir/base/app/scripts/xpiped_debug_attach.sh").text = file("$projectDir/debug/linux/xpiped_debug.sh").text.replace(
|
|
'JVM-ARGS',
|
|
debugAttachArguments + ' ' + debugArguments)
|
|
file("$distDir/base/app/scripts/xpiped_debug_attach.sh").executable = true
|
|
|
|
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"
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
task baseDist(type: DefaultTask) {
|
|
doLast {
|
|
copy {
|
|
from "$distDir/jpackage/xpiped.app/Contents"
|
|
into "$distDir/X-Pipe.app/Contents/"
|
|
}
|
|
copy {
|
|
from "$distDir/cli/xpipe"
|
|
into "$distDir/X-Pipe.app/Contents/MacOS/"
|
|
}
|
|
copy {
|
|
from "$distDir/licenses"
|
|
into "$distDir/X-Pipe.app/Contents/Resources/licenses"
|
|
}
|
|
copy {
|
|
from "$distDir/docs/html5"
|
|
into "$distDir/X-Pipe.app/Contents/Resources/cli/docs"
|
|
}
|
|
copy {
|
|
from "$distDir/docs/manpage"
|
|
into "$distDir/X-Pipe.app/Contents/Resources/cli/man"
|
|
}
|
|
copy {
|
|
from "$distDir/cli/xpipe_completion"
|
|
into "$distDir/X-Pipe.app/Contents/Resources/cli/"
|
|
}
|
|
|
|
copy {
|
|
from "$projectDir/PkgInstaller/macOS-x64/darwin/Resources/uninstall.sh"
|
|
into "$distDir/X-Pipe.app/Contents/Resources/scripts/"
|
|
}
|
|
file("$distDir/X-Pipe.app/Contents/Resources/scripts/uninstall.sh").text = file("$distDir/X-Pipe.app/Contents/Resources/scripts/uninstall.sh").text
|
|
.replaceAll("__PRODUCT__", "X-Pipe")
|
|
.replaceAll("__VERSION__", version.toString())
|
|
|
|
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/X-Pipe.app/Contents/Resources/scripts").mkdirs()
|
|
file("$distDir/X-Pipe.app/Contents/Resources/scripts/xpiped_debug.sh").text = file("$projectDir/debug/mac/xpiped_debug.sh").text.replace(
|
|
'JVM-ARGS',
|
|
debugArguments)
|
|
file("$distDir/X-Pipe.app/Contents/Resources/scripts/xpiped_debug.sh").executable = true
|
|
file("$distDir/X-Pipe.app/Contents/Resources/scripts/xpiped_debug_attach.sh").text = file("$projectDir/debug/mac/xpiped_debug.sh").text.replace(
|
|
'JVM-ARGS',
|
|
debugAttachArguments + ' ' + debugArguments)
|
|
file("$distDir/X-Pipe.app/Contents/Resources/scripts/xpiped_debug_attach.sh").executable = true
|
|
|
|
if (System.getenv("MACOS_DEVELOPER_ID_APPLICATION_CERTIFICATE_NAME") != null) {
|
|
10
|
|
exec {
|
|
commandLine "$projectDir/misc/mac/notarize.sh", "$projectDir"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
baseDist.dependsOn(licenses)
|
|
baseDist.dependsOn(jpackage)
|
|
dist.dependsOn(baseDist)
|