xpipe/build.gradle

72 lines
3.2 KiB
Groovy
Raw Normal View History

2023-09-27 13:47:51 +13:00
import java.util.stream.Stream
2022-06-18 11:17:08 +12:00
plugins {
2023-01-27 15:34:46 +13:00
id "io.codearte.nexus-staging" version "0.30.0"
2022-06-18 11:17:08 +12:00
}
2023-01-27 15:34:46 +13: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
}
2023-01-27 15:34:46 +13:00
project.ext {
ci = System.getenv('CI') != null
os = org.gradle.internal.os.OperatingSystem.current()
2023-09-27 13:47:51 +13: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 15:34:46 +13: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 23:05:26 +13:00
isFullRelease = System.getenv('RELEASE') != null && Boolean.parseBoolean(System.getenv('RELEASE'))
2023-04-13 08:47:31 +12:00
isStage = System.getenv('STAGE') != null && Boolean.parseBoolean(System.getenv('STAGE'))
2023-09-27 13:47:51 +13: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-11 10:52:20 +13:00
buildId = UUID.nameUUIDFromBytes(versionString.getBytes())
2023-02-11 02:46:54 +13:00
obfuscate = true
2023-09-27 13:47:51 +13: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'
publisher = 'XPipe UG (haftungsbeschränkt)'
shortDescription = 'The shell connection hub and remote file browser for your entire infrastructure'
longDescription = 'XPipe is a new type of shell connection hub and remote file manager that allows you to access your entire sever 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.'
website = 'https://xpipe.io'
sourceWebsite = 'https://github.com/xpipe-io/xpipe'
authors = 'Christopher Schnick'
2023-10-06 04:19:48 +13:00
artifactChecksums = new HashMap<String, String>()
2023-09-27 13:47:51 +13: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 15:34:46 +13:00
}