Build fixes

This commit is contained in:
crschnick 2023-02-10 13:46:54 +00:00
parent 131dec75ec
commit f2772fb2a4
4 changed files with 34 additions and 12 deletions

View file

@ -28,4 +28,6 @@ project.ext {
isFullRelease = System.getenv('RELEASE') != null && Boolean.parseBoolean(System.getenv('RELEASE')) isFullRelease = System.getenv('RELEASE') != null && Boolean.parseBoolean(System.getenv('RELEASE'))
versionString = file('version').text + (isFullRelease ? '' : '-SNAPSHOT') versionString = file('version').text + (isFullRelease ? '' : '-SNAPSHOT')
canonicalVersionString = file('version').text canonicalVersionString = file('version').text
buildId = UUID.nameUUIDFromBytes(version.toString().getBytes())
obfuscate = true
} }

5
dist/build.gradle vendored
View file

@ -25,11 +25,6 @@ repositories {
version = rootProject.versionString version = rootProject.versionString
project.ext {
buildId = UUID.nameUUIDFromBytes(version.toString().getBytes())
obfuscate = true
}
task dist(type: DefaultTask) {} task dist(type: DefaultTask) {}
clean { clean {

12
dist/jpackage.gradle vendored
View file

@ -6,7 +6,7 @@ def distJvmArgs = new ArrayList<String>(project(':app').application.applicationD
def releaseArguments = distJvmArgs + [ def releaseArguments = distJvmArgs + [
'-Dio.xpipe.app.writeLogs=true', '-Dio.xpipe.app.writeLogs=true',
"-Dio.xpipe.app.buildId=$project.buildId", "-Dio.xpipe.app.buildId=$rootProject.buildId",
'-Dio.xpipe.app.sentryUrl=https://fd5f67ff10764b7e8a704bec9558c8fe@o1084459.ingest.sentry.io/6094279' '-Dio.xpipe.app.sentryUrl=https://fd5f67ff10764b7e8a704bec9558c8fe@o1084459.ingest.sentry.io/6094279'
] ]
@ -94,13 +94,13 @@ jlink {
tasks.named('jlink').get().dependsOn(rootProject.getTasksByName("jar", true)) tasks.named('jlink').get().dependsOn(rootProject.getTasksByName("jar", true))
def outputName = org.gradle.internal.os.OperatingSystem.current().isMacOsX() ? 'xpiped.app/Contents/Resources' : 'xpiped' def outputName = org.gradle.internal.os.OperatingSystem.current().isMacOsX() ? 'xpiped.app/Contents/Resources' : 'xpiped'
def extModuleNames = Arrays.asList(file("$rootDir/ext").list()).stream() def extModules = Arrays.asList(file("$rootDir/ext").list()).stream()
.map(l -> project(":$l")).toList() .map(l -> project(":$l")).toList()
task copyBundledExtensions(type: DefaultTask) { task copyBundledExtensions(type: DefaultTask,
dependsOn: extModules.stream().map { it.getTasksByName('createExtOutput', true)[0] }.toList()) {
doLast { doLast {
for (def extProject : extModuleNames) { for (def extProject : extModules) {
def shouldObfuscate = project.ext.obfuscate && file("$rootDir/private_extensions.txt").exists() && file("$rootDir/private_extensions.txt").readLines().contains(extProject.getName()) def dir = "${extProject.buildDir}/libs_ext"
def dir = shouldObfuscate ? "${extProject.buildDir}/libs_obf" : "${extProject.buildDir}/libs"
if (file(dir).exists()) { if (file(dir).exists()) {
copy { copy {
from(dir) from(dir)

View file

@ -1,12 +1,37 @@
task copyRuntimeLibs(type: Copy) { task copyRuntimeLibs(type: Copy) {
into project.jar.destinationDirectory into project.jar.destinationDirectory
from configurations.runtimeClasspath from configurations.runtimeClasspath
exclude "${project.name}.jar", "${project.name.substring(0, project.name.length() - 1)}.jar" exclude "${project.name}.jar"
duplicatesStrategy(DuplicatesStrategy.EXCLUDE) duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
} }
copyRuntimeLibs.dependsOn(addDependenciesModuleInfo) copyRuntimeLibs.dependsOn(addDependenciesModuleInfo)
jar.dependsOn(copyRuntimeLibs) jar.dependsOn(copyRuntimeLibs)
task createExtOutput(type: Copy) {
def base = project.name.substring(0, project.name.length() - 1)
def isX = project.name.endsWith("x") && findProject(":$base") != null
doFirst {
if (!file("${project.jar.destinationDirectory.get()}_prod").exists()) {
copy {
from "${project.jar.destinationDirectory.get()}"
into "${project.jar.destinationDirectory.get()}_prod"
}
}
}
def shouldObfuscate = rootProject.obfuscate && rootProject.privateExtensions.contains(project.name)
var source = shouldObfuscate ? "${project.jar.destinationDirectory.get()}_prod" : "${project.jar.destinationDirectory.get()}"
if (isX) {
from source
into "${project(':' + base).jar.destinationDirectory.get()}_ext"
} else {
from source
into "${project.jar.destinationDirectory.get()}_ext"
}
}
apply from: "$rootDir/gradle/gradle_scripts/java.gradle" apply from: "$rootDir/gradle/gradle_scripts/java.gradle"
apply from: "$rootDir/gradle/gradle_scripts/javafx.gradle" apply from: "$rootDir/gradle/gradle_scripts/javafx.gradle"
apply from: "$rootDir/gradle/gradle_scripts/lombok.gradle" apply from: "$rootDir/gradle/gradle_scripts/lombok.gradle"