From e60b68152992847c17468376db8ca562b48640e9 Mon Sep 17 00:00:00 2001 From: ah-OOG-ah <75745146+ah-OOG-ah@users.noreply.github.com> Date: Sun, 11 Jan 2026 12:11:25 -0500 Subject: [PATCH] Remove GTNHMix mixin flavor (#65) * Remove GTNHMix mixin flavor * Re-add comments IDEA stripped --- module-mixin/build.gradle | 231 ++++++++++++++------------------- module-mixin/gradle.properties | 1 - scripts/check_upstream.py | 4 - 3 files changed, 101 insertions(+), 135 deletions(-) diff --git a/module-mixin/build.gradle b/module-mixin/build.gradle index fae1310..fb8d3de 100644 --- a/module-mixin/build.gradle +++ b/module-mixin/build.gradle @@ -23,13 +23,13 @@ dependencies { apply plugin: "com.github.johnrengelman.shadow" -def flavors = (!project.hasProperty("enableAltMixin") ? [] : ["spongepowered", "fabric", "gtnh"]) + ["unimix"] +def flavors = (!project.hasProperty("enableAltMixin") ? [] : ["spongepowered", "fabric"]) + ["unimix"] flavors.each { def mixinFlavor = it def _flavor = it.capitalize() def mixinFlavorClassifier = "UNKNOWN" - def mixinFlavorCapitalized = [spongepowered: "SpongePowered", fabric: "Fabric", gtnh: "GTNH", unimix: "UniMix"][mixinFlavor] + def mixinFlavorCapitalized = [spongepowered: "SpongePowered", fabric: "Fabric", unimix: "UniMix"][mixinFlavor] def mixinVersion = "UNKNOWN" configurations.create("shadow$_flavor") @@ -42,159 +42,130 @@ flavors.each { }) } - if (mixinFlavor == "fabric" || mixinFlavor == "spongepowered" || mixinFlavor == "unimix" || mixinFlavor == "gtnh") { - // Fabric / SpongePowered / UniMix / GTNH - - if (mixinFlavor == "fabric" || mixinFlavor == "unimix") { - def uniLocal = mixinFlavor == "unimix" && project.hasProperty("local") - mixinVersion = mixinFlavor == "fabric" ? fabricMixinVersion : unimixMixinVersion - if (uniLocal) { - mixinVersion += "-local" - } + if (mixinFlavor == "fabric" || mixinFlavor == "unimix") { + def uniLocal = mixinFlavor == "unimix" && project.hasProperty("local") + mixinVersion = mixinFlavor == "fabric" ? fabricMixinVersion : unimixMixinVersion + if (uniLocal) { + mixinVersion += "-local" + } - def mixinGroup = mixinFlavor == "fabric" ? "net.fabricmc" : "io.github.legacymoddingmc" - def mixinArtifactId = "sponge-mixin" - def mixinDepVersion = mixinVersion - def mixinDep = "$mixinGroup:$mixinArtifactId:$mixinDepVersion" + def mixinGroup = mixinFlavor == "fabric" ? "net.fabricmc" : "io.github.legacymoddingmc" + def mixinArtifactId = "sponge-mixin" + def mixinDepVersion = mixinVersion + def mixinDep = "$mixinGroup:$mixinArtifactId:$mixinDepVersion" - mixinFlavorClassifier = "$mixinFlavor.${mixinVersion.replace('+', '-')}" - - dependencies { - add("shadow$_flavor", "$mixinDep", { - exclude group: "org.ow2.asm" - }) - add("shadow$_flavor", "org.ow2.asm:asm-tree:$asmVersion") - add("shadow$_flavor", "org.ow2.asm:asm-commons:$asmVersion") - add("shadow$_flavor", "org.ow2.asm:asm-util:$asmVersion") + mixinFlavorClassifier = "$mixinFlavor.${mixinVersion.replace('+', '-')}" - add("shadowBridge$_flavor", "$mixinDep", { - transitive = false - }) + dependencies { + add("shadow$_flavor", "$mixinDep", { + exclude group: "org.ow2.asm" + }) + add("shadow$_flavor", "org.ow2.asm:asm-tree:$asmVersion") + add("shadow$_flavor", "org.ow2.asm:asm-commons:$asmVersion") + add("shadow$_flavor", "org.ow2.asm:asm-util:$asmVersion") - add("shadowSources$_flavor", "$mixinDep:sources", { - transitive = false - }) - } - } else if(mixinFlavor == "spongepowered") { - mixinVersion = spongepoweredMixinVersion - - mixinFlavorClassifier = "spongepowered.$mixinVersion" - - dependencies { - add("shadow$_flavor", "org.spongepowered:mixin:$mixinVersion") - add("shadowBridge$_flavor", "org.spongepowered:mixin:$mixinVersion", { - transitive = false - }) - add("shadow$_flavor", "com.google.guava:guava:21.0") - add("shadow$_flavor", "com.google.code.gson:gson:2.2.4") - add("shadow$_flavor", "org.ow2.asm:asm-tree:$asmVersion") - add("shadow$_flavor", "org.ow2.asm:asm-commons:$asmVersion") - add("shadow$_flavor", "org.ow2.asm:asm-util:$asmVersion") + add("shadowBridge$_flavor", "$mixinDep", { + transitive = false + }) - add("shadowSources$_flavor", "org.spongepowered:mixin:$mixinVersion:sources") - } - } else if(mixinFlavor == "gtnh") { - // Adapted from GTNHMixins's build script + add("shadowSources$_flavor", "$mixinDep:sources", { + transitive = false + }) + } + } else if(mixinFlavor == "spongepowered") { + mixinVersion = spongepoweredMixinVersion - mixinVersion = gtnhMixinVersion - mixinFlavorClassifier = "gtnh.$mixinVersion" - - dependencies { - add("shadow$_flavor", "org.spongepowered:mixin:$mixinVersion") - add("shadow$_flavor", "org.ow2.asm:asm-tree:$asmVersion") - add("shadow$_flavor", "org.ow2.asm:asm-commons:$asmVersion") - add("shadow$_flavor", "org.ow2.asm:asm-util:$asmVersion") - add("shadow$_flavor", "com.google.guava:guava:21.0") - add("shadowBridge$_flavor", "org.spongepowered:mixin:$spongepoweredMixinVersion") - add("shadowSources$_flavor", "org.spongepowered:mixin:$spongepoweredMixinVersion:sources") - } + mixinFlavorClassifier = "spongepowered.$mixinVersion" - } + dependencies { + add("shadow$_flavor", "org.spongepowered:mixin:$mixinVersion") + add("shadowBridge$_flavor", "org.spongepowered:mixin:$mixinVersion", { + transitive = false + }) + add("shadow$_flavor", "com.google.guava:guava:21.0") + add("shadow$_flavor", "com.google.code.gson:gson:2.2.4") + add("shadow$_flavor", "org.ow2.asm:asm-tree:$asmVersion") + add("shadow$_flavor", "org.ow2.asm:asm-commons:$asmVersion") + add("shadow$_flavor", "org.ow2.asm:asm-util:$asmVersion") - // We want to *not* relocate ASM in the bridge classes. So we use a multi-step - // build procedure: + add("shadowSources$_flavor", "org.spongepowered:mixin:$mixinVersion:sources") + } + } - // 1. Create relocated Mixin jar, without the bridge classes - task("mixinJar$_flavor", type: ShadowJar) { - destinationDirectory = file("build/tmp") - classifier = "tmpMixin$_flavor" - configurations = [project.configurations."shadow$_flavor"] + // We want to *not* relocate ASM in the bridge classes. So we use a multi-step + // build procedure: - relocate 'org.objectweb.asm', 'org.spongepowered.asm.lib' - if(mixinFlavor != "gtnh") { - relocate 'com.google', 'org.spongepowered.libraries.com.google' - } else { - // we don't use this ASM package name - //relocate 'org.objectweb.asm', 'org.spongepowered.libraries.org.objectweb.asm' - relocate 'com.google.common', 'org.spongepowered.libraries.com.google.common' - relocate 'com.google.thirdparty.publicsuffix', 'org.spongepowered.libraries.com.google.thirdparty.publicsuffix' - } + // 1. Create relocated Mixin jar, without the bridge classes + task("mixinJar$_flavor", type: ShadowJar) { + destinationDirectory = file("build/tmp") + classifier = "tmpMixin$_flavor" + configurations = [project.configurations."shadow$_flavor"] - exclude 'org/spongepowered/asm/bridge/RemapperAdapter.class' - exclude 'org/spongepowered/asm/bridge/RemapperAdapterFML.class' + relocate 'org.objectweb.asm', 'org.spongepowered.asm.lib' + relocate 'com.google', 'org.spongepowered.libraries.com.google' - // Exclude stuff that's compiled for Java 16 + exclude 'org/spongepowered/asm/bridge/RemapperAdapter.class' + exclude 'org/spongepowered/asm/bridge/RemapperAdapterFML.class' - exclude 'org/spongepowered/asm/service/modlauncher/*' - exclude 'org/spongepowered/asm/launch/MixinTransformationServiceLegacy*' - exclude 'org/spongepowered/asm/launch/MixinLaunchPlugin*' - exclude 'org/spongepowered/asm/launch/MixinTransformationService*' - exclude 'org/spongepowered/asm/launch/platform/container/ContainerHandleModLauncherEx*' + // Exclude stuff that's compiled for Java 16 - exclude 'META-INF/services/cpw.mods.modlauncher.api.ITransformationService' - exclude 'META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService' - - exclude '**/module-info.class' + exclude 'org/spongepowered/asm/service/modlauncher/*' + exclude 'org/spongepowered/asm/launch/MixinTransformationServiceLegacy*' + exclude 'org/spongepowered/asm/launch/MixinLaunchPlugin*' + exclude 'org/spongepowered/asm/launch/MixinTransformationService*' + exclude 'org/spongepowered/asm/launch/platform/container/ContainerHandleModLauncherEx*' - // Exclude jar-specific stuff + exclude 'META-INF/services/cpw.mods.modlauncher.api.ITransformationService' + exclude 'META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService' - exclude 'META-INF/MANIFEST.MF', 'META-INF/maven/**', 'META-INF/*.RSA', 'META-INF/*.SF' - } + exclude '**/module-info.class' - // 2. Create Mixin jar without relocation, with *only* the bridge classes - task("bridgeJar$_flavor", type: ShadowJar) { - destinationDirectory = file("build/tmp") - classifier = "tmpBridge$_flavor" - configurations = [project.configurations."shadowBridge$_flavor"] + // Exclude jar-specific stuff - include '*.jar' - include 'org/spongepowered/asm/bridge/*' - } + exclude 'META-INF/MANIFEST.MF', 'META-INF/maven/**', 'META-INF/*.RSA', 'META-INF/*.SF' + } - // 3. Combine the two jars - task("shadowJar$_flavor", type: ShadowJar) { - version = versionBase + "+" + mixinFlavorClassifier - from(sourceSets.main.output) { - exclude "mcmod.info" - } + // 2. Create Mixin jar without relocation, with *only* the bridge classes + task("bridgeJar$_flavor", type: ShadowJar) { + destinationDirectory = file("build/tmp") + classifier = "tmpBridge$_flavor" + configurations = [project.configurations."shadowBridge$_flavor"] - relocate 'io.github.legacymoddingmc.unimixins.common', 'io.github.legacymoddingmc.unimixins.mixin.repackage.common' + include '*.jar' + include 'org/spongepowered/asm/bridge/*' + } - dependsOn "mixinJar$_flavor" - dependsOn "bridgeJar$_flavor" - dependsOn "mixinJar$_flavor" - dependsOn "bridgeJar$_flavor" + // 3. Combine the two jars + task("shadowJar$_flavor", type: ShadowJar) { + version = versionBase + "+" + mixinFlavorClassifier + from(sourceSets.main.output) { + exclude "mcmod.info" + } - from zipTree(tasks."mixinJar$_flavor".archiveFile).matching { - exclude 'module-info.class' - eachFile { - if(it.path.startsWith("META-INF/services/")) { - it.filter({l -> !l.startsWith("org.spongepowered.asm.service.modlauncher.") ? l : null}) - } - } - } - from zipTree(tasks."bridgeJar$_flavor".archiveFile).matching { include 'org/spongepowered/asm/bridge/*' } + relocate 'io.github.legacymoddingmc.unimixins.common', 'io.github.legacymoddingmc.unimixins.mixin.repackage.common' - doLast { - delete tasks."mixinJar$_flavor".archiveFile - delete tasks."bridgeJar$_flavor".archiveFile - } - } + dependsOn "mixinJar$_flavor" + dependsOn "bridgeJar$_flavor" + dependsOn "mixinJar$_flavor" + dependsOn "bridgeJar$_flavor" - jar.dependsOn("shadowJar$_flavor") - } + from zipTree(tasks."mixinJar$_flavor".archiveFile).matching { + exclude 'module-info.class' + eachFile { + if(it.path.startsWith("META-INF/services/")) { + it.filter({l -> !l.startsWith("org.spongepowered.asm.service.modlauncher.") ? l : null}) + } + } + } + from zipTree(tasks."bridgeJar$_flavor".archiveFile).matching { include 'org/spongepowered/asm/bridge/*' } - // Common + doLast { + delete tasks."mixinJar$_flavor".archiveFile + delete tasks."bridgeJar$_flavor".archiveFile + } + } + + jar.dependsOn("shadowJar$_flavor") task("createMcmodInfo$_flavor", type: Copy) { outputs.upToDateWhen { false } diff --git a/module-mixin/gradle.properties b/module-mixin/gradle.properties index 9adf411..a77a0f9 100644 --- a/module-mixin/gradle.properties +++ b/module-mixin/gradle.properties @@ -1,6 +1,5 @@ fabricMixinVersion=0.15.3+mixin.0.8.7 unimixMixinVersion=0.15.5+mixin.0.8.7 spongepoweredMixinVersion=0.8.7 -gtnhMixinVersion=0.8.7-GTNH-2 asmVersion=9.9.1 diff --git a/scripts/check_upstream.py b/scripts/check_upstream.py index f5f386f..b4d98cc 100644 --- a/scripts/check_upstream.py +++ b/scripts/check_upstream.py @@ -108,10 +108,6 @@ compareVersion("Mixin (UniMix)", stripBuildIdentifiers(property(localFile("module-mixin/gradle.properties"), "unimixMixinVersion")), property(githubFile("LegacyModdingMC", "UniMix/main", "gradle.properties"), "buildVersion")) -compareVersion("Mixin (GTNH)", - stripBuildIdentifiers(property(localFile("module-mixin/gradle.properties"), "gtnhMixinVersion")), - lastVersionTag("GTNewHorizons/SpongePoweredMixin")) # GTNH doesn't have a master branch - compareVersions("GTNHMixins", creditsSources("module-gtnhmixins"))