2024-02-13 12:10:20 +00:00
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
2023-09-27 00:47:51 +00:00
import java.util.stream.Stream
2022-06-17 23:17:08 +00:00
plugins {
2023-01-27 02:34:46 +00:00
id "io.codearte.nexus-staging" version "0.30.0"
2024-02-13 12:10:20 +00:00
id 'org.gradlex.extra-java-module-info' version '1.8' apply false
}
allprojects { subproject - >
apply plugin: 'org.gradlex.extra-java-module-info'
extraJavaModuleInfo {
failOnMissingModuleInfo . set ( false )
}
apply from: "$rootDir/modules.gradle"
2022-06-17 23:17:08 +00:00
}
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
2022-06-26 18:49:51 +00:00
}
2024-02-13 12:10:20 +00:00
def getPlatformName ( ) {
def currentOS = DefaultNativePlatform . currentOperatingSystem ;
def platform = null
if ( currentOS . isWindows ( ) ) {
platform = 'windows'
} else if ( currentOS . isLinux ( ) ) {
platform = 'linux'
} else if ( currentOS . isMacOsX ( ) ) {
platform = 'osx'
}
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' ) )
2023-04-12 20:47:31 +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'
publisher = 'XPipe UG (haftungsbeschränkt)'
2023-10-18 04:17:34 +00:00
shortDescription = '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'
sourceWebsite = 'https://github.com/xpipe-io/xpipe'
authors = 'Christopher Schnick'
2024-02-13 12:10:20 +00:00
javafxVersion = '22-ea+27'
platformName = getPlatformName ( )
artifactChecksums = new HashMap < String , String > ( )
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" ,
"-Xmx8g" ,
"-Dio.xpipe.app.arch=$rootProject.arch" ,
"-Dfile.encoding=UTF-8" ,
// Disable this for now as it requires Windows 10+
// '-XX:+UseZGC',
2024-02-15 10:52:38 +00:00
"-Dvisualvm.display.name=XPipe" ,
"-Dapple.awt.application.appearance=system"
2024-02-13 12:10:20 +00:00
]
useBundledJavaFx = fullVersion & & ! ( platformName = = 'linux' & & arch = = 'arm64' )
2024-02-19 20:42:06 +00:00
announce = System . getenv ( 'SKIP_ANNOUNCEMENT' ) = = null | | ! Boolean . parseBoolean ( System . getenv ( 'SKIP_ANNOUNCEMENT' ) )
2024-02-19 22:31:21 +00:00
changelogFile = file ( "$rootDir/dist/changelogs/${versionString}.md" ) . exists ( ) ?
file ( "$rootDir/dist/changelogs/${versionString}.md" ) :
file ( "$rootDir/dist/changelogs/${canonicalVersionString}.md" )
2023-09-27 00:47:51 +00:00
}
2024-02-17 21:10:56 +00:00
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" )
}
2024-01-18 20:30:29 +00:00
if ( isFullRelease & & rawVersion . contains ( "-" ) ) {
throw new IllegalArgumentException ( "Releases must have canonical versions" )
}
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
}
2024-02-13 12:10:20 +00:00
def testTasks = [
project ( ':core' ) . getTasksByName ( 'test' , true ) ,
project ( ':api' ) . getTasksByName ( 'test' , true ) ,
project ( ':app' ) . getTasksByName ( 'test' , true ) ,
project ( ':base' ) . getTasksByName ( 'localTest' , true ) ,
project ( ':jdbc' ) . getTasksByName ( 'localTest' , true ) ,
project ( ':proc' ) . getTasksByName ( 'localTest' , true ) ,
project ( ':cli' ) . getTasksByName ( 'remoteTest' , true ) ,
]
tasks . register ( 'testReport' , TestReport ) {
getDestinationDirectory ( ) . set ( file ( "$rootProject.buildDir/reports/all" ) )
2024-02-13 19:04:08 +00:00
getTestResults ( ) . from ( testTasks . stream ( ) . filter { ! it . isEmpty ( ) } . map {
2024-02-13 12:10:20 +00:00
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 )
}