xpipe-mirror/build.gradle

240 lines
9.6 KiB
Groovy
Raw Normal View History

import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
2023-09-27 00:47:51 +00:00
import java.util.stream.Stream
2024-04-27 18:41:07 +00:00
buildscript {
configurations.classpath {
resolutionStrategy {
// Fix https://github.com/jreleaser/jreleaser/issues/1643
force 'org.eclipse.jgit:org.eclipse.jgit:5.13.0.202109080827-r'
}
}
}
2022-06-17 23:17:08 +00:00
plugins {
2024-07-17 09:24:42 +00:00
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
id 'org.gradlex.extra-java-module-info' version '1.8' apply false
2024-04-18 21:37:28 +00:00
id("com.diffplug.spotless") version "6.25.0" apply false
}
allprojects { subproject ->
apply plugin: 'org.gradlex.extra-java-module-info'
extraJavaModuleInfo {
failOnMissingModuleInfo.set(false)
}
2024-05-10 12:22:15 +00:00
apply from: "$rootDir/gradle/gradle_scripts/modules.gradle"
2022-06-17 23:17:08 +00:00
}
2024-04-18 21:37:28 +00:00
subprojects {subproject ->
2024-04-27 13:28:06 +00:00
if (subproject.name == 'dist') {
return
}
2024-04-18 21:37:28 +00:00
apply plugin: 'com.diffplug.spotless'
spotless {
java {
palantirJavaFormat()
trimTrailingWhitespace()
endWithNewline()
importOrder('io.xpipe', 'javafx', '', 'java', '\\#')
}
}
}
2024-07-17 09:24:42 +00:00
def user = project.hasProperty('sonatypeUsername') ? project.property('sonatypeUsername') : System.getenv('SONATYPE_USERNAME')
def pass = project.hasProperty('sonatypePassword') ? project.property('sonatypePassword') : System.getenv('SONATYPE_PASSWORD')
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri('https://s01.oss.sonatype.org/service/local/'))
snapshotRepositoryUrl.set(uri('https://s01.oss.sonatype.org/content/repositories/snapshots/'))
username = user
password = pass
}
}
useStaging = true
}
2024-05-10 12:22:15 +00:00
var devProps = file("$rootDir/app/dev.properties")
if (!devProps.exists()) {
devProps.text = file("$rootDir/gradle/gradle_scripts/dev_default.properties").text
}
2023-01-27 02:34:46 +00:00
def getArchName() {
var arch = System.getProperty("os.arch").toLowerCase(Locale.ROOT)
if (arch == 'amd64' || arch == 'x86_64') {
return 'x86_64'
}
if (arch == 'arm' || arch == 'aarch64') {
return 'arm64'
}
if (arch == 'x86') {
return 'x86'
}
return arch
}
def getPlatformName() {
def currentOS = DefaultNativePlatform.currentOperatingSystem;
2024-08-03 07:56:34 +00:00
def platform
if (currentOS.isWindows()) {
platform = 'windows'
2024-08-03 07:56:34 +00:00
} else if (currentOS.isMacOsX()) {
platform = 'osx'
2024-08-03 07:56:34 +00:00
} else {
platform = 'linux'
}
return platform;
}
2023-01-27 02:34:46 +00:00
project.ext {
ci = System.getenv('CI') != null
os = org.gradle.internal.os.OperatingSystem.current()
2023-09-27 00:47:51 +00:00
allExtensions = Stream.concat(Stream.of(project(':base')), Arrays.stream(file("$rootDir/ext").list())
.filter(s -> file("$rootDir/ext/$s/build.gradle").exists())
.filter(s -> !s.equals('base') && !s.equals('csv') && !s.equals('office') && !s.equals('pdx') && !s.equals('jackson') && !s.equals(
'collections'))
.map(l -> project(":$l"))).toList()
2023-01-27 02:34:46 +00:00
fullVersion = file("$rootDir/private_files.txt").exists()
arch = getArchName()
privateExtensions = file("$rootDir/private_extensions.txt").exists() ? file("$rootDir/private_extensions.txt").readLines() : []
2023-02-01 10:05:26 +00:00
isFullRelease = System.getenv('RELEASE') != null && Boolean.parseBoolean(System.getenv('RELEASE'))
2024-06-15 10:41:14 +00:00
isStage = System.getenv('STAGE') != null && Boolean.parseBoolean(System.getenv('STAGE'))
2023-09-27 00:47:51 +00:00
rawVersion = file('version').text.trim()
versionString = rawVersion + (isFullRelease || isStage ? '' : '-SNAPSHOT')
versionReleaseNumber = rawVersion.split('-').length == 2 ? Integer.parseInt(rawVersion.split('-')[1]) : 1
canonicalVersionString = rawVersion.split('-').length == 2 ? rawVersion.split('-')[0] : rawVersion
2023-02-10 21:52:20 +00:00
buildId = UUID.nameUUIDFromBytes(versionString.getBytes())
2023-02-10 13:46:54 +00:00
obfuscate = true
2023-09-27 00:47:51 +00:00
changelog = file("dist/changelogs/${canonicalVersionString}.md").exists() ? file("dist/changelogs/${canonicalVersionString}.md").text.trim() + '\n' : ""
productName = isStage ? 'XPipe PTB' : 'XPipe'
kebapProductName = isStage ? 'xpipe-ptb' : 'xpipe'
2024-05-02 23:12:37 +00:00
flatcaseProductName = isStage ? 'xpipeptb' : 'xpipe'
2023-09-27 00:47:51 +00:00
publisher = 'XPipe UG (haftungsbeschränkt)'
2024-05-02 20:19:14 +00:00
shortDescription = isStage ? 'XPipe PTB (Public Test Build)' : 'Your entire server infrastructure at your fingertips'
2023-11-04 05:36:47 +00:00
longDescription = 'XPipe is a new type of shell connection hub and remote file manager that allows you to access your entire server infrastructure from your local machine. It works on top of your installed command-line programs that you normally use to connect and does not require any setup on your remote systems.'
2023-09-27 00:47:51 +00:00
website = 'https://xpipe.io'
2024-05-02 20:19:14 +00:00
sourceWebsite = isStage ? 'https://github.com/xpipe-io/xpipe-ptb' : 'https://github.com/xpipe-io/xpipe'
2023-09-27 00:47:51 +00:00
authors = 'Christopher Schnick'
2024-08-25 12:47:01 +00:00
javafxVersion = '24-ea+5'
platformName = getPlatformName()
2024-04-22 04:43:02 +00:00
languages = ["en", "nl", "es", "fr", "de", "it", "pt", "ru", "ja", "zh", "tr", "da"]
jvmRunArgs = [
"--add-opens", "java.base/java.lang=io.xpipe.app",
"--add-opens", "java.base/java.lang=io.xpipe.core",
"--add-opens", "java.desktop/java.awt=io.xpipe.app",
"--add-opens", "net.synedra.validatorfx/net.synedra.validatorfx=io.xpipe.app",
"--add-opens", "java.base/java.nio.file=io.xpipe.app",
2024-04-13 16:23:09 +00:00
"--add-exports", "javafx.graphics/com.sun.javafx.tk=io.xpipe.app",
"--add-opens", "javafx.graphics/com.sun.glass.ui=io.xpipe.app",
"--add-opens", "javafx.graphics/javafx.stage=io.xpipe.app",
"--add-opens", "javafx.graphics/com.sun.javafx.tk.quantum=io.xpipe.app",
"-Xmx8g",
"-Dio.xpipe.app.arch=$rootProject.arch",
2024-05-02 23:18:41 +00:00
"-Dio.xpipe.app.languages=${String.join(",", languages)}",
"-Dfile.encoding=UTF-8",
"-Dvisualvm.display.name=XPipe",
2024-10-02 18:12:42 +00:00
"-Djavafx.preloader=io.xpipe.app.core.AppPreloader",
"-Djdk.virtualThreadScheduler.parallelism=8"
]
2024-08-03 08:19:33 +00:00
// Disable this on Windows for now as it requires Windows 10+
if (org.gradle.internal.os.OperatingSystem.current().isLinux() || org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
2024-07-28 19:48:33 +00:00
jvmRunArgs += ['-XX:+UseZGC']
}
2024-05-26 20:33:30 +00:00
if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
jvmRunArgs += ["-Dapple.awt.application.appearance=system"]
}
2024-03-23 04:05:10 +00:00
useBundledJavaFx = fullVersion
2024-03-25 08:15:31 +00:00
useBundledJna = fullVersion
announce = System.getenv('SKIP_ANNOUNCEMENT') == null || !Boolean.parseBoolean(System.getenv('SKIP_ANNOUNCEMENT'))
changelogFile = file("$rootDir/dist/changelogs/${versionString}.md").exists() ?
file("$rootDir/dist/changelogs/${versionString}.md") :
file("$rootDir/dist/changelogs/${canonicalVersionString}.md")
2024-02-29 09:38:53 +00:00
incrementalChangelogFile = file("$rootDir/dist/changelogs/${canonicalVersionString}_incremental.md")
2024-03-21 04:48:05 +00:00
signingKeyId = project.hasProperty('signingKeyId') ? project.property("signingKeyId") : System.getenv('GPG_KEY_ID')
signingKey = project.hasProperty('signingKeyFile') ? file(project.property("signingKeyFile")).text : System.getenv('GPG_KEY')
signingPassword = project.hasProperty('signingKeyPassword') ? project.property("signingKeyPassword") : System.getenv('GPG_KEY_PASSWORD')
if (signingPassword == null) {
signingPassword = ''
}
2024-04-13 16:23:09 +00:00
deeplApiKey = findProperty('DEEPL_API_KEY')
2024-05-07 04:35:18 +00:00
customJavaFxPath = null
}
if (org.gradle.internal.os.OperatingSystem.current() == org.gradle.internal.os.OperatingSystem.LINUX) {
jvmRunArgs.addAll("--add-opens", "java.desktop/sun.awt.X11=io.xpipe.app")
}
if (org.gradle.internal.os.OperatingSystem.current() == org.gradle.internal.os.OperatingSystem.MAC_OS) {
jvmRunArgs.addAll("--add-exports", "java.desktop/com.apple.eawt=io.xpipe.app")
2023-09-27 00:47:51 +00:00
}
2024-01-18 20:30:29 +00:00
if (isFullRelease && rawVersion.contains("-")) {
throw new IllegalArgumentException("Releases must have canonical versions")
}
2024-06-15 10:40:03 +00:00
if (isStage && !rawVersion.contains("-")) {
throw new IllegalArgumentException("Stage releases must have release numbers")
}
2023-09-27 00:47:51 +00:00
def replaceVariablesInFileAsString(String f, Map<String, String> replacements) {
def fileName = file(f).getName()
def text = file(f).text
def replaced = text.replace(replacements)
return replaced
}
def replaceVariablesInFile(String f, Map<String, String> replacements) {
def fileName = file(f).getName()
def text = file(f).text
def replaced = text.replace(replacements)
def build = "${project.layout.buildDirectory.get()}/${UUID.randomUUID()}"
file(build).mkdirs()
def temp = "$build/$fileName"
file(temp).text = replaced
return file(temp)
2023-01-27 02:34:46 +00:00
}
def testTasks = [
project(':core').getTasksByName('test', true),
project(':app').getTasksByName('test', true),
project(':base').getTasksByName('localTest', true),
project(':jdbc').getTasksByName('localTest', true),
project(':proc').getTasksByName('localTest', true),
]
2024-04-24 17:31:48 +00:00
if (file("cli").exists()) {
testTasks += [project(':cli').getTasksByName('remoteTest', true)]
}
tasks.register('testReport', TestReport) {
getDestinationDirectory().set(file("$rootProject.buildDir/reports/all"))
getTestResults().from(testTasks.stream().filter {!it.isEmpty()}.map {
file("${it.project.buildDir.get(0)}/test-results/${it.name.get(0)}/binary")
}.toList())
}
task testAll(type: DefaultTask) {
for (final def t in testTasks) {
t.forEach {dependsOn(it.getTaskDependencies())}
}
doFirst {
for (final def t in testTasks) {
t.forEach {it.executeTests()}
}
}
finalizedBy(testReport)
}
2024-07-17 09:24:42 +00:00
group = 'io.xpipe'
version = versionString