diff options
| author | 2025-08-21 23:53:50 +0300 | |
|---|---|---|
| committer | 2025-08-21 21:53:50 +0100 | |
| commit | a61fe39f4e86ce5ab2c0615612deae1c51aff927 (patch) | |
| tree | 8035d1659782571fd24980d89779d8287413e29e /enigma | |
| parent | Get rid of Guava (#555) (diff) | |
| download | enigma-fork-a61fe39f4e86ce5ab2c0615612deae1c51aff927.tar.gz enigma-fork-a61fe39f4e86ce5ab2c0615612deae1c51aff927.tar.xz enigma-fork-a61fe39f4e86ce5ab2c0615612deae1c51aff927.zip | |
Update Gradle and fix buildscripts (#557)
* Fix Gradle configuration cache compat with generateResources task
The task now also declares its inputs properly, making it support
up-to-date checks.
* Update Gradle and Shadow
Shadow 9 is incompatible with including the flatlaf natives,
so I updated to the last 8.x version which also works with Gradle 9.
The Shadow plugin automatically publishes the shadow jar, so I removed
the overlapping publications which overrode each other.
* Fix more Gradle 10 deprecations
* Enable configuration cache by default
* Fix missing task dependency of :enigma-cli:test
Diffstat (limited to 'enigma')
| -rw-r--r-- | enigma/build.gradle | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/enigma/build.gradle b/enigma/build.gradle index 6bbb200..e92052f 100644 --- a/enigma/build.gradle +++ b/enigma/build.gradle | |||
| @@ -19,15 +19,20 @@ dependencies { | |||
| 19 | 19 | ||
| 20 | // Generate "version.txt" file | 20 | // Generate "version.txt" file |
| 21 | 21 | ||
| 22 | ext.genOutputDir = file("$buildDir/generated-resources") | 22 | def genOutputDir = layout.buildDirectory.dir('generated-resources').get().asFile |
| 23 | 23 | ||
| 24 | task generateResources { | 24 | tasks.register('generateResources') { |
| 25 | ext.versionFile = file("$genOutputDir/version.txt") | 25 | def langDir = file('src/main/resources/lang') |
| 26 | ext.langsFile = file("$genOutputDir/lang/index.txt") | 26 | inputs.dir(langDir) |
| 27 | inputs.property 'version', project.version | ||
| 28 | |||
| 29 | def versionFile = file("$genOutputDir/version.txt") | ||
| 30 | def langsFile = file("$genOutputDir/lang/index.txt") | ||
| 27 | outputs.files(versionFile, langsFile) | 31 | outputs.files(versionFile, langsFile) |
| 32 | |||
| 28 | doLast { | 33 | doLast { |
| 29 | versionFile.text = "${project.version}" | 34 | versionFile.text = inputs.properties.version |
| 30 | langsFile.text = file("$projectDir/src/main/resources/lang") | 35 | langsFile.text = langDir |
| 31 | .listFiles() | 36 | .listFiles() |
| 32 | .collect { it.name } | 37 | .collect { it.name } |
| 33 | .findAll { it.endsWith(".json") } | 38 | .findAll { it.endsWith(".json") } |
| @@ -45,7 +50,7 @@ def libraryJarsArg = "<java.home>/jmods" | |||
| 45 | // If your test fails for class file version problem with proguard, run gradle with -Dorg.gradle.java.home="<older jdk>" flag | 50 | // If your test fails for class file version problem with proguard, run gradle with -Dorg.gradle.java.home="<older jdk>" flag |
| 46 | file('src/test/java/cuchaz/enigma/inputs').listFiles().each { theFile -> | 51 | file('src/test/java/cuchaz/enigma/inputs').listFiles().each { theFile -> |
| 47 | if (theFile.directory) { | 52 | if (theFile.directory) { |
| 48 | task("${theFile.name}TestJar", type: Jar) { | 53 | tasks.register("${theFile.name}TestJar", Jar) { |
| 49 | from(sourceSets.test.output) { | 54 | from(sourceSets.test.output) { |
| 50 | include "cuchaz/enigma/inputs/$theFile.name/**/*.class" | 55 | include "cuchaz/enigma/inputs/$theFile.name/**/*.class" |
| 51 | include 'cuchaz/enigma/inputs/Keep.class' | 56 | include 'cuchaz/enigma/inputs/Keep.class' |
| @@ -55,8 +60,8 @@ file('src/test/java/cuchaz/enigma/inputs').listFiles().each { theFile -> | |||
| 55 | destinationDirectory = file('build/test-inputs') | 60 | destinationDirectory = file('build/test-inputs') |
| 56 | } | 61 | } |
| 57 | 62 | ||
| 58 | task("${theFile.name}TestObf", type: JavaExec, | 63 | tasks.register("${theFile.name}TestObf", JavaExec) { |
| 59 | dependsOn: "${theFile.name}TestJar") { | 64 | dependsOn "${theFile.name}TestJar" |
| 60 | mainClass = 'proguard.ProGuard' | 65 | mainClass = 'proguard.ProGuard' |
| 61 | classpath configurations.proGuard | 66 | classpath configurations.proGuard |
| 62 | 67 | ||