From 5ed022957e2eacfc82658530259815c91c9aea10 Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Thu, 7 Aug 2025 11:56:12 +0200 Subject: [PATCH 01/10] build: Update shadow plugin To the latest version which still works on Gradle 8.8. --- build-logic/build.gradle.kts | 2 +- build-logic/src/main/kotlin/essential/shadowWithInnerJars.kt | 4 ++-- integrationTest/launchwrapper/build.gradle | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index b73ab85..dc917ff 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -7,7 +7,7 @@ repositories { } dependencies { - api("gradle.plugin.com.github.johnrengelman:shadow:7.1.2") + api("com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:8.3.9") implementation("org.ow2.asm:asm-commons:9.3") } diff --git a/build-logic/src/main/kotlin/essential/shadowWithInnerJars.kt b/build-logic/src/main/kotlin/essential/shadowWithInnerJars.kt index d0c3a60..b79eef6 100644 --- a/build-logic/src/main/kotlin/essential/shadowWithInnerJars.kt +++ b/build-logic/src/main/kotlin/essential/shadowWithInnerJars.kt @@ -4,8 +4,8 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer import com.github.jengelman.gradle.plugins.shadow.transformers.TransformerContext import org.gradle.api.file.FileTreeElement -import shadow.org.apache.tools.zip.ZipEntry -import shadow.org.apache.tools.zip.ZipOutputStream +import org.apache.tools.zip.ZipEntry +import org.apache.tools.zip.ZipOutputStream /** * Shadow by default recursively explodes all jar files. diff --git a/integrationTest/launchwrapper/build.gradle b/integrationTest/launchwrapper/build.gradle index d3d8312..8f0331d 100644 --- a/integrationTest/launchwrapper/build.gradle +++ b/integrationTest/launchwrapper/build.gradle @@ -9,7 +9,7 @@ import java.util.zip.ZipFile import java.util.zip.ZipOutputStream plugins { - id "com.github.johnrengelman.shadow" version "7.1.2" apply false + id "com.gradleup.shadow" version "8.3.9" apply false } repositories { From 62aef9987aca88dd80ff1268a089175822456e59 Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Thu, 7 Aug 2025 11:58:45 +0200 Subject: [PATCH 02/10] build: Centralize repository declarations The space-to-assign (`url ""` being equal to `url = ""`) Groovy syntax is being deprecated, so while we have to touch all these lines, we may as well centralize all repos into the `settings.gradle.kts` file. --- build.gradle | 5 ----- integrationTest/fabric/build.gradle | 4 ---- integrationTest/launchwrapper/build.gradle | 5 ----- mixin/build.gradle.kts | 6 ------ settings.gradle.kts | 12 ++++++++++++ stage0/fabric/build.gradle | 4 ---- stage0/modlauncher/build.gradle | 4 ---- stage0/modlauncher8/build.gradle | 4 ---- stage0/modlauncher9/build.gradle | 4 ---- stage1/fabric/build.gradle | 4 ---- stage1/launchwrapper/build.gradle | 4 ---- stage1/modlauncher/build.gradle | 4 ---- stage1/modlauncher8/build.gradle | 4 ---- stage1/modlauncher9/build.gradle | 4 ---- stage2/fabric/build.gradle | 4 ---- stage2/launchwrapper-legacy/build.gradle | 4 ---- stage2/launchwrapper/build.gradle | 4 ---- stage2/modlauncher8/build.gradle | 4 ---- stage2/modlauncher9/build.gradle | 4 ---- stage2/modlauncher9/compatibility/build.gradle | 4 ---- stage2/modlauncher9/forge37/build.gradle | 4 ---- stage2/modlauncher9/forge40/build.gradle | 4 ---- stage2/modlauncher9/forge41/build.gradle | 4 ---- stage2/modlauncher9/forge49/build.gradle | 4 ---- stage2/modlauncher9/modlauncher10/build.gradle | 4 ---- stage2/modlauncher9/modlauncher11/build.gradle | 4 ---- stage2/modlauncher9/neoforge1/build.gradle | 4 ---- stage2/modlauncher9/neoforge4/build.gradle | 4 ---- 28 files changed, 12 insertions(+), 112 deletions(-) diff --git a/build.gradle b/build.gradle index 44cd116..b400527 100644 --- a/build.gradle +++ b/build.gradle @@ -19,11 +19,6 @@ subprojects { "modlauncher11": 21, ] java.toolchain.languageVersion.set(JavaLanguageVersion.of(javaVersions.getOrDefault(project.name, 8))) - - repositories { - mavenCentral() - maven { url "https://libraries.minecraft.net/" } - } } allprojects { diff --git a/integrationTest/fabric/build.gradle b/integrationTest/fabric/build.gradle index 0127078..0ddaf13 100644 --- a/integrationTest/fabric/build.gradle +++ b/integrationTest/fabric/build.gradle @@ -1,9 +1,5 @@ import java.util.function.Supplier -repositories { - maven { url "https://maven.fabricmc.net/" } -} - sourceSets { exampleMod essential diff --git a/integrationTest/launchwrapper/build.gradle b/integrationTest/launchwrapper/build.gradle index 8f0331d..7bc3a54 100644 --- a/integrationTest/launchwrapper/build.gradle +++ b/integrationTest/launchwrapper/build.gradle @@ -12,11 +12,6 @@ plugins { id "com.gradleup.shadow" version "8.3.9" apply false } -repositories { - maven { url "https://maven.minecraftforge.net/" } - maven { url "https://repo.spongepowered.org/maven" } -} - sourceSets { exampleMod example2Mod diff --git a/mixin/build.gradle.kts b/mixin/build.gradle.kts index 8e2d455..2e121f3 100644 --- a/mixin/build.gradle.kts +++ b/mixin/build.gradle.kts @@ -16,12 +16,6 @@ val asmVersion = "5.2" version = "$patchesVersion+mixin.$mixinVersion" java.toolchain.languageVersion.set(JavaLanguageVersion.of(8)) -repositories { - mavenCentral() - maven("https://repo.spongepowered.org/repository/maven-releases/") - maven("https://libraries.minecraft.net") -} - val relocated = registerRelocationAttribute("essential-guava21-relocated") { relocate("com.google.common", "gg.essential.lib.guava21") relocate("com.google.thirdparty.publicsuffix", "gg.essential.lib.guava21.publicsuffix") diff --git a/settings.gradle.kts b/settings.gradle.kts index ae917da..9bd6143 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -9,6 +9,18 @@ pluginManagement { } } +dependencyResolutionManagement { + repositoriesMode = RepositoriesMode.PREFER_SETTINGS + repositories { + mavenCentral() + maven(url = "https://maven.fabricmc.net/") + maven(url = "https://repo.spongepowered.org/maven") + maven(url = "https://maven.neoforged.net/releases") + maven(url = "https://maven.minecraftforge.net/") + maven(url = "https://libraries.minecraft.net/") + } +} + includeBuild("build-logic") include(":container:fabric") diff --git a/stage0/fabric/build.gradle b/stage0/fabric/build.gradle index 194846c..32b8f64 100644 --- a/stage0/fabric/build.gradle +++ b/stage0/fabric/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.fabricmc.net/" } -} - dependencies { compileOnly("net.fabricmc:fabric-loader:0.11.6") compileOnly("net.fabricmc:sponge-mixin:0.9.4+mixin.0.8.2") diff --git a/stage0/modlauncher/build.gradle b/stage0/modlauncher/build.gradle index 4547373..c2c3d22 100644 --- a/stage0/modlauncher/build.gradle +++ b/stage0/modlauncher/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly(parent.project("common")) diff --git a/stage0/modlauncher8/build.gradle b/stage0/modlauncher8/build.gradle index 00d115b..218dea3 100644 --- a/stage0/modlauncher8/build.gradle +++ b/stage0/modlauncher8/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly("cpw.mods:modlauncher:8.1.3") // modlauncher uses these in its api but does not declare them as such diff --git a/stage0/modlauncher9/build.gradle b/stage0/modlauncher9/build.gradle index e981db8..fe203d0 100644 --- a/stage0/modlauncher9/build.gradle +++ b/stage0/modlauncher9/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly("cpw.mods:modlauncher:9.0.7") // modlauncher uses these in its api but does not declare them as such diff --git a/stage1/fabric/build.gradle b/stage1/fabric/build.gradle index 11ece5a..18983ce 100644 --- a/stage1/fabric/build.gradle +++ b/stage1/fabric/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.fabricmc.net/" } -} - dependencies { compileOnly("net.fabricmc:fabric-loader:0.11.6") compileOnly("net.fabricmc:sponge-mixin:0.9.4+mixin.0.8.2") diff --git a/stage1/launchwrapper/build.gradle b/stage1/launchwrapper/build.gradle index 1495706..698a370 100644 --- a/stage1/launchwrapper/build.gradle +++ b/stage1/launchwrapper/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9:universal") compileOnly("net.minecraft:launchwrapper:1.12") diff --git a/stage1/modlauncher/build.gradle b/stage1/modlauncher/build.gradle index 4547373..c2c3d22 100644 --- a/stage1/modlauncher/build.gradle +++ b/stage1/modlauncher/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly(parent.project("common")) diff --git a/stage1/modlauncher8/build.gradle b/stage1/modlauncher8/build.gradle index 8fe5d04..ad6fe2f 100644 --- a/stage1/modlauncher8/build.gradle +++ b/stage1/modlauncher8/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly("cpw.mods:modlauncher:8.1.3") // modlauncher uses these in its api but does not declare them as such diff --git a/stage1/modlauncher9/build.gradle b/stage1/modlauncher9/build.gradle index c085c3e..5b733fe 100644 --- a/stage1/modlauncher9/build.gradle +++ b/stage1/modlauncher9/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly("cpw.mods:modlauncher:9.0.7") // modlauncher uses these in its api but does not declare them as such diff --git a/stage2/fabric/build.gradle b/stage2/fabric/build.gradle index aa8f356..448de6d 100644 --- a/stage2/fabric/build.gradle +++ b/stage2/fabric/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.fabricmc.net/" } -} - dependencies { compileOnly("org.jetbrains:annotations:23.0.0") compileOnly("net.fabricmc:fabric-loader:0.11.6") diff --git a/stage2/launchwrapper-legacy/build.gradle b/stage2/launchwrapper-legacy/build.gradle index 693be04..866ee25 100644 --- a/stage2/launchwrapper-legacy/build.gradle +++ b/stage2/launchwrapper-legacy/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly("net.minecraft:launchwrapper:1.12") } diff --git a/stage2/launchwrapper/build.gradle b/stage2/launchwrapper/build.gradle index fbcd195..31ff4ce 100644 --- a/stage2/launchwrapper/build.gradle +++ b/stage2/launchwrapper/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9:universal") compileOnly("net.minecraft:launchwrapper:1.12") diff --git a/stage2/modlauncher8/build.gradle b/stage2/modlauncher8/build.gradle index 6b2e38f..3fba3d2 100644 --- a/stage2/modlauncher8/build.gradle +++ b/stage2/modlauncher8/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly("cpw.mods:modlauncher:8.1.3") // modlauncher uses these in its api but does not declare them as such diff --git a/stage2/modlauncher9/build.gradle b/stage2/modlauncher9/build.gradle index cdd52cb..4674145 100644 --- a/stage2/modlauncher9/build.gradle +++ b/stage2/modlauncher9/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { bundle(implementation(project("compatibility"))) bundle(project("forge37")) diff --git a/stage2/modlauncher9/compatibility/build.gradle b/stage2/modlauncher9/compatibility/build.gradle index 91a2ba4..4c6436c 100644 --- a/stage2/modlauncher9/compatibility/build.gradle +++ b/stage2/modlauncher9/compatibility/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly(project(":stage2:common")) diff --git a/stage2/modlauncher9/forge37/build.gradle b/stage2/modlauncher9/forge37/build.gradle index ea01b97..eeaf0d2 100644 --- a/stage2/modlauncher9/forge37/build.gradle +++ b/stage2/modlauncher9/forge37/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly(parent.project("compatibility")) diff --git a/stage2/modlauncher9/forge40/build.gradle b/stage2/modlauncher9/forge40/build.gradle index 98d8821..b830e22 100644 --- a/stage2/modlauncher9/forge40/build.gradle +++ b/stage2/modlauncher9/forge40/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly(parent.project("compatibility")) compileOnly(parent.project("forge37")) diff --git a/stage2/modlauncher9/forge41/build.gradle b/stage2/modlauncher9/forge41/build.gradle index 00b8f1f..6ba5dc9 100644 --- a/stage2/modlauncher9/forge41/build.gradle +++ b/stage2/modlauncher9/forge41/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly(parent.project("compatibility")) compileOnly(parent.project("forge37")) diff --git a/stage2/modlauncher9/forge49/build.gradle b/stage2/modlauncher9/forge49/build.gradle index 9954c08..14ada25 100644 --- a/stage2/modlauncher9/forge49/build.gradle +++ b/stage2/modlauncher9/forge49/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly(parent.project("compatibility")) compileOnly(parent.project("forge37")) diff --git a/stage2/modlauncher9/modlauncher10/build.gradle b/stage2/modlauncher9/modlauncher10/build.gradle index 9e80653..bac65b9 100644 --- a/stage2/modlauncher9/modlauncher10/build.gradle +++ b/stage2/modlauncher9/modlauncher10/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.minecraftforge.net/" } -} - dependencies { compileOnly(project(":stage2:common")) compileOnly(parent.project("compatibility")) diff --git a/stage2/modlauncher9/modlauncher11/build.gradle b/stage2/modlauncher9/modlauncher11/build.gradle index 8df20f6..1f5f91f 100644 --- a/stage2/modlauncher9/modlauncher11/build.gradle +++ b/stage2/modlauncher9/modlauncher11/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.neoforged.net/releases" } -} - dependencies { compileOnly(project(":stage2:common")) compileOnly(parent.project("compatibility")) diff --git a/stage2/modlauncher9/neoforge1/build.gradle b/stage2/modlauncher9/neoforge1/build.gradle index 6a3d769..e49c11b 100644 --- a/stage2/modlauncher9/neoforge1/build.gradle +++ b/stage2/modlauncher9/neoforge1/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.neoforged.net/releases" } -} - dependencies { compileOnly(parent.project("compatibility")) diff --git a/stage2/modlauncher9/neoforge4/build.gradle b/stage2/modlauncher9/neoforge4/build.gradle index f1a5278..feacb8d 100644 --- a/stage2/modlauncher9/neoforge4/build.gradle +++ b/stage2/modlauncher9/neoforge4/build.gradle @@ -1,7 +1,3 @@ -repositories { - maven { url "https://maven.neoforged.net/releases" } -} - dependencies { compileOnly(parent.project("compatibility")) compileOnly(parent.project("neoforge1")) From e33934184c74c4e82a9cba40cf0bb329472ab96e Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Thu, 7 Aug 2025 12:00:06 +0200 Subject: [PATCH 03/10] build: Remove unused subproject Projects for which the folder does not exist are deprecated. --- settings.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 9bd6143..8852e72 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -59,4 +59,3 @@ include(":mixin") include(":integrationTest:common") include(":integrationTest:fabric") include(":integrationTest:launchwrapper") -include(":integrationTest:modlauncher") From a1896415c4fa1f4707126c246933f9457fa6c6ae Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Thu, 7 Aug 2025 12:03:24 +0200 Subject: [PATCH 04/10] build: Add explicit junit-platform-launcher dependency Relying on automatic test framework implementation dependencies is deprecated. --- integrationTest/common/build.gradle | 1 + stage1/common/build.gradle | 1 + stage2/common/build.gradle | 1 + 3 files changed, 3 insertions(+) diff --git a/integrationTest/common/build.gradle b/integrationTest/common/build.gradle index ceeff2e..82208bf 100644 --- a/integrationTest/common/build.gradle +++ b/integrationTest/common/build.gradle @@ -2,6 +2,7 @@ apply plugin: 'java-library' dependencies { api("org.junit.jupiter:junit-jupiter:5.7.2") + runtimeOnly("org.junit.platform:junit-platform-launcher") implementation("org.ow2.asm:asm-commons:5.0") implementation("com.google.guava:guava:21.0") diff --git a/stage1/common/build.gradle b/stage1/common/build.gradle index bef73ea..7a94b67 100644 --- a/stage1/common/build.gradle +++ b/stage1/common/build.gradle @@ -8,6 +8,7 @@ dependencies { compileOnly("com.google.code.gson:gson:2.2.4") testImplementation("org.junit.jupiter:junit-jupiter:5.7.1") + testRuntimeOnly("org.junit.platform:junit-platform-launcher") } test { diff --git a/stage2/common/build.gradle b/stage2/common/build.gradle index 5d87509..9ba356c 100644 --- a/stage2/common/build.gradle +++ b/stage2/common/build.gradle @@ -16,6 +16,7 @@ dependencies { compileOnly("org.jetbrains:annotations:23.0.0") testImplementation("org.junit.jupiter:junit-jupiter:5.7.2") + testRuntimeOnly("org.junit.platform:junit-platform-launcher") } test { From b952f462f208760e3d9f562ae79f8072bc164fae Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Thu, 7 Aug 2025 12:33:26 +0200 Subject: [PATCH 05/10] build: Fix deprecated API usage --- build.gradle | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index b400527..8f7036f 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,9 @@ subprojects { apply plugin: "java" group = "gg.essential" - archivesBaseName = "essential-loader" + path.replace(':', '-') + base { + archivesName = "essential-loader" + path.replace(':', '-') + } def javaVersions = [ "compatibility": 16, @@ -25,7 +27,7 @@ allprojects { tasks.withType(AbstractArchiveTask.class).configureEach { preserveFileTimestamps = false reproducibleFileOrder = true - dirMode = 0755 - fileMode = 0644 + dirPermissions { unix("755") } + filePermissions { unix("644") } } } From 7747d1dc2114b3e02062aa1af13bb7361a21eeaa Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Thu, 7 Aug 2025 12:33:45 +0200 Subject: [PATCH 06/10] build: Fix deprecated space-to-assign Groovy syntax --- stage0/build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stage0/build.gradle b/stage0/build.gradle index 572b8d4..83e8647 100644 --- a/stage0/build.gradle +++ b/stage0/build.gradle @@ -38,12 +38,12 @@ configure(subprojects.findAll { it.name != "common" && it.name != "modlauncher" repositories { if (project.hasProperty("nexus_user")) { maven { - name 'nexus' - url "https://repo.essential.gg/repository/maven-releases/" + name = "nexus" + url = "https://repo.essential.gg/repository/maven-releases/" credentials { - username project.nexus_user - password project.nexus_password + username = project.nexus_user + password = project.nexus_password } } } From 69a145765dd77b840710b0bc720169689907d801 Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Thu, 7 Aug 2025 12:43:18 +0200 Subject: [PATCH 07/10] build: Replace `project.zipTree` with `ArchiveOperations` Access to `project` during task execution is incompatible with the Configuration Cache feature which is enabled by default with Gradle 9. --- .../configureModLauncherContainerJar.kt | 5 ++- integrationTest/fabric/build.gradle | 14 ++++++-- integrationTest/launchwrapper/build.gradle | 32 ++++++++++++------- mixin/build.gradle.kts | 5 ++- stage0/build.gradle | 9 +++++- 5 files changed, 47 insertions(+), 18 deletions(-) diff --git a/build-logic/src/main/kotlin/essential/configureModLauncherContainerJar.kt b/build-logic/src/main/kotlin/essential/configureModLauncherContainerJar.kt index e5484bf..e372e37 100644 --- a/build-logic/src/main/kotlin/essential/configureModLauncherContainerJar.kt +++ b/build-logic/src/main/kotlin/essential/configureModLauncherContainerJar.kt @@ -2,10 +2,13 @@ package essential import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import org.gradle.api.artifacts.Configuration +import org.gradle.api.file.ArchiveOperations +import org.gradle.kotlin.dsl.support.serviceOf fun ShadowJar.configureModLauncherContainerJar(configuration: Configuration) { dependsOn(configuration) - from({ project.zipTree(configuration.singleFile) }) + val archiveOps = project.serviceOf() + from({ archiveOps.zipTree(configuration.singleFile) }) preserveJars() // We cannot relocate the whole package cause the stage1.jar must remain in the same place diff --git a/integrationTest/fabric/build.gradle b/integrationTest/fabric/build.gradle index 0ddaf13..300c5e3 100644 --- a/integrationTest/fabric/build.gradle +++ b/integrationTest/fabric/build.gradle @@ -1,4 +1,12 @@ import java.util.function.Supplier +import javax.inject.Inject + +interface Injected { + @Inject ArchiveOperations getArchiveOps() +} + +def injected = objects.newInstance(Injected.class) +def archiveOps = injected.getArchiveOps() sourceSets { exampleMod @@ -147,7 +155,7 @@ tasks.register("essentialJijijJar", Jar) { (1..5).each { i -> def stage2Task = tasks.register("stage2V${i}Jar", Jar) { archiveBaseName.set(name) - from(evaluationDependsOn(':stage2:fabric').tasks.jar.archiveFile.map { zipTree(it) }) + from(evaluationDependsOn(':stage2:fabric').tasks.jar.archiveFile.map { archiveOps.zipTree(it) }) // Dummy attribute so they all have different hashes manifest { attributes "Implementation-Version": "$i" @@ -155,7 +163,7 @@ tasks.register("essentialJijijJar", Jar) { } def stage3Task = tasks.register("stage3V${i}Jar", Jar) { archiveBaseName.set(name) - from(tasks.essentialJar.archiveFile.map { zipTree(it) }) + from(tasks.essentialJar.archiveFile.map { archiveOps.zipTree(it) }) manifest { // Dummy attribute so they all have different hashes attributes "Implementation-Version": "$i" @@ -167,7 +175,7 @@ tasks.register("essentialJijijJar", Jar) { } tasks.register("exampleBundledModJar$i", Jar) { archiveBaseName.set(name) - from(tasks.exampleModJar.archiveFile.map { zipTree(it) }) + from(tasks.exampleModJar.archiveFile.map { archiveOps.zipTree(it) }) def stage2Jar = stage2Task.get().archiveFile def stage3Jar = stage3Task.get().archiveFile diff --git a/integrationTest/launchwrapper/build.gradle b/integrationTest/launchwrapper/build.gradle index 7bc3a54..7327f7f 100644 --- a/integrationTest/launchwrapper/build.gradle +++ b/integrationTest/launchwrapper/build.gradle @@ -7,11 +7,19 @@ import java.util.function.Supplier import java.util.zip.ZipEntry import java.util.zip.ZipFile import java.util.zip.ZipOutputStream +import javax.inject.Inject plugins { id "com.gradleup.shadow" version "8.3.9" apply false } +interface Injected { + @Inject ArchiveOperations getArchiveOps() +} + +def injected = objects.newInstance(Injected.class) +def archiveOps = injected.getArchiveOps() + sourceSets { exampleMod example2Mod @@ -121,9 +129,9 @@ def integrationTest = tasks.register("integrationTest", Test) { } check.dependsOn(integrationTest) -def includeMixin(AbstractArchiveTask task, Configuration mixin) { +def includeMixin = { AbstractArchiveTask task, Configuration mixin -> task.dependsOn(mixin) - task.from({ mixin.collect { zipTree(it) } }) { + task.from({ mixin.collect { archiveOps.zipTree(it) } }) { exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA' } } @@ -132,7 +140,7 @@ def configureExampleModJar = { String tweaker, Configuration mixin = null, exclu archiveBaseName.set(task.name) from(sourceSets.exampleMod.output) dependsOn(configurations.exampleModRuntimeClasspath) - from({ configurations.exampleModRuntimeClasspath.collect { zipTree(it) } }) { + from({ configurations.exampleModRuntimeClasspath.collect { archiveOps.zipTree(it) } }) { if (excludes != null) { excludes() } @@ -156,7 +164,7 @@ def configureExample2ModJar = { String tweaker, Configuration mixin = null -> re archiveBaseName.set(name) from(sourceSets.example2Mod.output) dependsOn(configurations.example2ModRuntimeClasspath) - from({ configurations.example2ModRuntimeClasspath.collect { zipTree(it) } }) + from({ configurations.example2ModRuntimeClasspath.collect { archiveOps.zipTree(it) } }) manifest { attributes "FMLCorePlugin": "com.example.mod2.ExampleCoreMod", @@ -237,7 +245,7 @@ tasks.register("exampleRelocatedModJar", com.github.jengelman.gradle.plugins.sha (1..5).each { i -> def stage2Task = tasks.register("stage2V${i}Jar", Jar) { archiveBaseName.set(name) - from(evaluationDependsOn(':stage2:launchwrapper').tasks.jar.archiveFile.map { zipTree(it) }) + from(evaluationDependsOn(':stage2:launchwrapper').tasks.jar.archiveFile.map { archiveOps.zipTree(it) }) manifest { attributes "Name": "gg/essential/loader/stage2/" attributes "Implementation-Version": "$i" @@ -245,7 +253,7 @@ tasks.register("exampleRelocatedModJar", com.github.jengelman.gradle.plugins.sha } def stage1Task = tasks.register("stage1V${i}Jar", Jar) { archiveBaseName.set(name) - from(evaluationDependsOn(':stage1:launchwrapper').tasks.jar.archiveFile.map { zipTree(it) }) { + from(evaluationDependsOn(':stage1:launchwrapper').tasks.jar.archiveFile.map { archiveOps.zipTree(it) }) { exclude("gg/essential/loader/stage1/stage2.jar") } from(stage2Task.flatMap { it.archiveFile }) { @@ -259,7 +267,7 @@ tasks.register("exampleRelocatedModJar", com.github.jengelman.gradle.plugins.sha } def stage3Task = tasks.register("stage3V${i}Jar", Jar) { archiveBaseName.set(name) - from(tasks.essentialJar.archiveFile.map { zipTree(it) }) + from(tasks.essentialJar.archiveFile.map { archiveOps.zipTree(it) }) from(stage1Task.flatMap { it.archiveFile }) { into("gg/essential/loader/stage0") rename { "stage1.jar" } @@ -313,7 +321,7 @@ tasks.register("essentialWithAsm52Jar", Jar) { includeMixin(it, configurations.mixin07) dependsOn(configurations.asm52) - from({ configurations.asm52.collect { zipTree(it) } }) + from({ configurations.asm52.collect { archiveOps.zipTree(it) } }) } tasks.register("essentialWithDummyStage1", Jar) { @@ -348,10 +356,10 @@ tasks.register("dummyStage3Jar", Jar) { tasks.register("dummyStage3DiffJar", Jar) { archiveBaseName.set("dummyStage3Diff") - from(essentialJar.archiveFile.map { zipTree(it) }) { + from(essentialJar.archiveFile.map { archiveOps.zipTree(it) }) { into("-") } - from(dummyStage3Jar.archiveFile.map { zipTree(it) }) { + from(dummyStage3Jar.archiveFile.map { archiveOps.zipTree(it) }) { into("~") } } @@ -361,7 +369,7 @@ tasks.register("forge10808Jar", Jar) { from(sourceSets.minecraft10808.output) dependsOn(configurations.forge10808Runtime) - from({ configurations.forge10808Runtime.collect { zipTree(it) } }) { + from({ configurations.forge10808Runtime.collect { archiveOps.zipTree(it) } }) { exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA' exclude 'META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat' exclude 'net/minecraftforge/fml/common/launcher/TerminalTweaker.class' @@ -373,7 +381,7 @@ tasks.register("forge11202Jar", Jar) { from(sourceSets.minecraft11202.output) dependsOn(configurations.forge11202Runtime) - from({ configurations.forge11202Runtime.collect { zipTree(it) } }) { + from({ configurations.forge11202Runtime.collect { archiveOps.zipTree(it) } }) { exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA' exclude 'META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat' exclude 'net/minecraftforge/fml/common/launcher/TerminalTweaker.class' diff --git a/mixin/build.gradle.kts b/mixin/build.gradle.kts index 2e121f3..e0bf0ad 100644 --- a/mixin/build.gradle.kts +++ b/mixin/build.gradle.kts @@ -1,6 +1,8 @@ import essential.CompatMixinTask import gg.essential.gradle.util.prebundle import gg.essential.gradle.util.RelocationTransform.Companion.registerRelocationAttribute +import org.gradle.api.file.ArchiveOperations +import org.gradle.kotlin.dsl.support.serviceOf plugins { id("java-library") @@ -61,7 +63,8 @@ val patchedJar by tasks.registering(CompatMixinTask::class) { } tasks.jar { - from(patchedJar.flatMap { it.output }.map { zipTree(it) }) { + val archiveOps = project.serviceOf() + from(patchedJar.flatMap { it.output }.map { archiveOps.zipTree(it) }) { // Signatures were invalidated by patching exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA") // Legacy Forge chokes on these (and they are useless for it anyway cause it only supports Java 8) diff --git a/stage0/build.gradle b/stage0/build.gradle index 83e8647..cc2b720 100644 --- a/stage0/build.gradle +++ b/stage0/build.gradle @@ -1,5 +1,9 @@ version = "1.3.0" +interface Injected { + @javax.inject.Inject ArchiveOperations getArchiveOps() +} + configure(subprojects.findAll { it.name != "common" && it.name != "modlauncher" }) { apply plugin: 'maven-publish' @@ -18,9 +22,12 @@ configure(subprojects.findAll { it.name != "common" && it.name != "modlauncher" } } + def injected = objects.newInstance(Injected.class) + def archiveOps = injected.getArchiveOps() + jar { dependsOn configurations.bundle - from { configurations.bundle.collect { zipTree(it) } } + from { configurations.bundle.collect { archiveOps.zipTree(it) } } from(evaluationDependsOn(":stage1:$variant").tasks.named("jar").map { it.outputs }) { rename { "gg/essential/loader/stage0/stage1.jar" } From 9e26cfe797761e90c3248cd661d945ef9814a558 Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Thu, 14 Aug 2025 10:44:22 +0200 Subject: [PATCH 08/10] build: Fix implicit reference to `project` during task execution --- stage0/fabric/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/stage0/fabric/build.gradle b/stage0/fabric/build.gradle index 32b8f64..322ea7a 100644 --- a/stage0/fabric/build.gradle +++ b/stage0/fabric/build.gradle @@ -5,6 +5,7 @@ dependencies { } tasks.named("processResources") { + def version = version inputs.property("version", version) filesMatching("fabric.mod.json") { expand("version": version) From 3cde428c9615af6b52f067737fe067446d19c12f Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Thu, 7 Aug 2025 12:59:11 +0200 Subject: [PATCH 09/10] build: Replace `outputs` with `archiveFile` Because `Task`, which is referenced from `TaskOutputs`, isn't serializable as far as the Configuration Cache is concerned. --- integrationTest/launchwrapper/build.gradle | 2 +- stage0/build.gradle | 2 +- stage1/launchwrapper/build.gradle | 2 +- stage2/launchwrapper-legacy/build.gradle | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integrationTest/launchwrapper/build.gradle b/integrationTest/launchwrapper/build.gradle index 7327f7f..2aa98c3 100644 --- a/integrationTest/launchwrapper/build.gradle +++ b/integrationTest/launchwrapper/build.gradle @@ -329,7 +329,7 @@ tasks.register("essentialWithDummyStage1", Jar) { from(sourceSets.essential.output) includeMixin(it, configurations.mixin07) - from(tasks.named("dummyStage1Jar").map { it.outputs }) { + from(tasks.named("dummyStage1Jar").map { it.archiveFile }) { rename { "gg/essential/loader/stage0/stage1.jar" } } } diff --git a/stage0/build.gradle b/stage0/build.gradle index cc2b720..62c4250 100644 --- a/stage0/build.gradle +++ b/stage0/build.gradle @@ -29,7 +29,7 @@ configure(subprojects.findAll { it.name != "common" && it.name != "modlauncher" dependsOn configurations.bundle from { configurations.bundle.collect { archiveOps.zipTree(it) } } - from(evaluationDependsOn(":stage1:$variant").tasks.named("jar").map { it.outputs }) { + from(evaluationDependsOn(":stage1:$variant").tasks.named("jar").map { it.archiveFile }) { rename { "gg/essential/loader/stage0/stage1.jar" } } } diff --git a/stage1/launchwrapper/build.gradle b/stage1/launchwrapper/build.gradle index 698a370..f42cad2 100644 --- a/stage1/launchwrapper/build.gradle +++ b/stage1/launchwrapper/build.gradle @@ -12,7 +12,7 @@ dependencies { } jar { - from(evaluationDependsOn(":stage2:launchwrapper").tasks.named("jar").map { it.outputs }) { + from(evaluationDependsOn(":stage2:launchwrapper").tasks.named("jar").map { it.archiveFile }) { rename { "gg/essential/loader/stage1/stage2.jar" } } } diff --git a/stage2/launchwrapper-legacy/build.gradle b/stage2/launchwrapper-legacy/build.gradle index 866ee25..3297777 100644 --- a/stage2/launchwrapper-legacy/build.gradle +++ b/stage2/launchwrapper-legacy/build.gradle @@ -3,7 +3,7 @@ dependencies { } jar { - from(evaluationDependsOn(":stage2:launchwrapper").tasks.named("jar").map { it.outputs }) { + from(evaluationDependsOn(":stage2:launchwrapper").tasks.named("jar").map { it.archiveFile }) { rename { "gg/essential/loader/stage2/real-stage2.jar" } } } From d7b9b04a261fa3f87afe12bd6349bb133bd1b0f2 Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Thu, 7 Aug 2025 12:58:15 +0200 Subject: [PATCH 10/10] build: Replace `buildDir` with `layout.buildDirectory` --- container/fabric/build.gradle.kts | 2 +- container/launchwrapper/build.gradle.kts | 2 +- container/modlauncher8/build.gradle.kts | 2 +- container/modlauncher9/build.gradle.kts | 2 +- mixin/build.gradle.kts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/container/fabric/build.gradle.kts b/container/fabric/build.gradle.kts index 6bbe2ba..72825c0 100644 --- a/container/fabric/build.gradle.kts +++ b/container/fabric/build.gradle.kts @@ -10,7 +10,7 @@ dependencies { } val jar by tasks.registering(Jar::class) { - destinationDirectory.set(project.buildDir.resolve("libs")) + destinationDirectory.set(layout.buildDirectory.dir("libs")) archiveBaseName.set("container-${project.name}") dependsOn(stage0) diff --git a/container/launchwrapper/build.gradle.kts b/container/launchwrapper/build.gradle.kts index c4e0455..19d8326 100644 --- a/container/launchwrapper/build.gradle.kts +++ b/container/launchwrapper/build.gradle.kts @@ -10,7 +10,7 @@ dependencies { } val jar by tasks.registering(Jar::class) { - destinationDirectory.set(project.buildDir.resolve("libs")) + destinationDirectory.set(layout.buildDirectory.dir("libs")) archiveBaseName.set("container-${project.name}") dependsOn(stage0) diff --git a/container/modlauncher8/build.gradle.kts b/container/modlauncher8/build.gradle.kts index f54c426..2e763a1 100644 --- a/container/modlauncher8/build.gradle.kts +++ b/container/modlauncher8/build.gradle.kts @@ -13,7 +13,7 @@ dependencies { } val jar by tasks.registering(ShadowJar::class) { - destinationDirectory.set(project.buildDir.resolve("libs")) + destinationDirectory.set(layout.buildDirectory.dir("libs")) archiveBaseName.set("container-${project.name}") configureModLauncherContainerJar(stage0) diff --git a/container/modlauncher9/build.gradle.kts b/container/modlauncher9/build.gradle.kts index a82bbc1..9f71241 100644 --- a/container/modlauncher9/build.gradle.kts +++ b/container/modlauncher9/build.gradle.kts @@ -13,7 +13,7 @@ dependencies { } val jar by tasks.registering(ShadowJar::class) { - destinationDirectory.set(project.buildDir.resolve("libs")) + destinationDirectory.set(layout.buildDirectory.dir("libs")) archiveBaseName.set("container-${project.name}") configureModLauncherContainerJar(stage0) diff --git a/mixin/build.gradle.kts b/mixin/build.gradle.kts index e0bf0ad..fb65c7a 100644 --- a/mixin/build.gradle.kts +++ b/mixin/build.gradle.kts @@ -59,7 +59,7 @@ tasks.processResources { val patchedJar by tasks.registering(CompatMixinTask::class) { mixinClasses.from(sourceSets.main.map { it.output }) input.set(fatMixin.files.single()) - output.set(buildDir.resolve("patched.jar")) + output.set(layout.buildDirectory.file("patched.jar")) } tasks.jar {