From a61fe39f4e86ce5ab2c0615612deae1c51aff927 Mon Sep 17 00:00:00 2001 From: Juuz Date: Thu, 21 Aug 2025 23:53:50 +0300 Subject: 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--- enigma/build.gradle | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'enigma') 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 { // Generate "version.txt" file -ext.genOutputDir = file("$buildDir/generated-resources") +def genOutputDir = layout.buildDirectory.dir('generated-resources').get().asFile -task generateResources { - ext.versionFile = file("$genOutputDir/version.txt") - ext.langsFile = file("$genOutputDir/lang/index.txt") +tasks.register('generateResources') { + def langDir = file('src/main/resources/lang') + inputs.dir(langDir) + inputs.property 'version', project.version + + def versionFile = file("$genOutputDir/version.txt") + def langsFile = file("$genOutputDir/lang/index.txt") outputs.files(versionFile, langsFile) + doLast { - versionFile.text = "${project.version}" - langsFile.text = file("$projectDir/src/main/resources/lang") + versionFile.text = inputs.properties.version + langsFile.text = langDir .listFiles() .collect { it.name } .findAll { it.endsWith(".json") } @@ -45,7 +50,7 @@ def libraryJarsArg = "/jmods" // If your test fails for class file version problem with proguard, run gradle with -Dorg.gradle.java.home="" flag file('src/test/java/cuchaz/enigma/inputs').listFiles().each { theFile -> if (theFile.directory) { - task("${theFile.name}TestJar", type: Jar) { + tasks.register("${theFile.name}TestJar", Jar) { from(sourceSets.test.output) { include "cuchaz/enigma/inputs/$theFile.name/**/*.class" include 'cuchaz/enigma/inputs/Keep.class' @@ -55,8 +60,8 @@ file('src/test/java/cuchaz/enigma/inputs').listFiles().each { theFile -> destinationDirectory = file('build/test-inputs') } - task("${theFile.name}TestObf", type: JavaExec, - dependsOn: "${theFile.name}TestJar") { + tasks.register("${theFile.name}TestObf", JavaExec) { + dependsOn "${theFile.name}TestJar" mainClass = 'proguard.ProGuard' classpath configurations.proGuard -- cgit v1.2.3