From bdf73dd29a8f2820d3f80f7d7a461040df6b7957 Mon Sep 17 00:00:00 2001 From: FalsePattern <30945458+FalsePattern@users.noreply.github.com> Date: Thu, 1 Sep 2022 19:19:53 +0200 Subject: [PATCH] GasStation compat --- build.gradle | 58 +++++-------------- dependencies.gradle | 6 +- .../internal/asm/IMixinPluginTransformer.java | 12 ++-- .../falsepattern/lib/mixin/IMixinPlugin.java | 8 +-- .../extensibility/IMixinConfigPlugin.java | 41 ------------- 5 files changed, 29 insertions(+), 96 deletions(-) delete mode 100644 src/main/java/com/falsepattern/lib/mixin/stubpackage/org/spongepowered/asm/mixin/extensibility/IMixinConfigPlugin.java diff --git a/build.gradle b/build.gradle index 08f6b2f..92740bf 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1656003793falsepattern40 +//version: 1656003793falsepattern41 /* DO NOT CHANGE THIS FILE! @@ -126,7 +126,6 @@ propertyDefaultIfUnset("mavenArtifactId", "") propertyDefaultIfUnset("hasMixinDeps", false) propertyDefaultIfUnset("mixinPreinitConfig", "") propertyDefaultIfUnset("remapStubs", false) -propertyDefaultIfUnset("useObsoleteSpongeMixins", false) propertyDefaultIfUnset("modrinthProjectId", "") propertyDefaultIfUnset("modrinthDependencies", "") @@ -284,54 +283,29 @@ repositories { url = "https://gregtech.overminddl1.com/" } if(usesMixins.toBoolean() || hasMixinDeps.toBoolean()) { - if (useObsoleteSpongeMixins.toBoolean()) { - maven { - name = "sponge" - url = "https://mvn.falsepattern.com/sponge" - } + maven { + name = "sponge" + url = "https://mvn.falsepattern.com/releases" } maven { - url = "https://mvn.falsepattern.com/jitpack" + name = "sponge2" + url = "https://mvn.falsepattern.com/sponge" } } } dependencies { if(usesMixins.toBoolean()) { - if (useObsoleteSpongeMixins.toBoolean()) { - annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3") - annotationProcessor("com.google.guava:guava:24.1.1-jre") - annotationProcessor("com.google.code.gson:gson:2.8.6") - annotationProcessor("org.spongepowered:mixin:0.8-20200110.181151-15") - // using 0.8 to workaround a issue in 0.7 which fails mixin application - compile("org.spongepowered:mixin:0.7.11-20180703.121122-1") { - // Mixin includes a lot of dependencies that are too up-to-date - exclude module: "launchwrapper" - exclude module: "guava" - exclude module: "gson" - exclude module: "commons-io" - exclude module: "log4j-core" - } - compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev") - } else { - compile("com.github.tox1cozZ:mixin-booter-legacy:1.1.2") - annotationProcessor("com.github.tox1cozZ:mixin-booter-legacy:1.1.2:processor") - } - } - if(hasMixinDeps.toBoolean()) { - if (useObsoleteSpongeMixins.toBoolean()) { - runtime("org.spongepowered:mixin:0.7.11-20180703.121122-1") { - // Mixin includes a lot of dependencies that are too up-to-date - exclude module: "launchwrapper" - exclude module: "guava" - exclude module: "gson" - exclude module: "commons-io" - exclude module: "log4j-core" - } - runtime("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev") - } else { - runtime("com.github.tox1cozZ:mixin-booter-legacy:1.1.2") - } + annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3") + annotationProcessor("com.google.guava:guava:24.1.1-jre") + annotationProcessor("com.google.code.gson:gson:2.8.6") + annotationProcessor("org.spongepowered:mixin:0.8.3-gasstation") + compile("org.spongepowered:mixin:0.8.3-gasstation") + compile("com.falsepattern:gasstation-mc1.7.10:7370815:dev") + } else if(hasMixinDeps.toBoolean()) { + runtime("org.spongepowered:mixin:0.8.3-gasstation") + runtime("com.llamalad7:MixinExtras:0.0.12-gasstation") + runtime("com.falsepattern:gasstation-mc1.7.10:7370815:dev") } } diff --git a/dependencies.gradle b/dependencies.gradle index 9bbd558..54e8b78 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -2,9 +2,9 @@ dependencies { compileOnly("org.projectlombok:lombok:1.18.22") { transitive = false } - compileOnly("com.github.tox1cozZ:mixin-booter-legacy:1.1.2") { - transitive = false - } + compileOnly("org.spongepowered:mixin:0.8.3-gasstation") + compileOnly("com.llamalad7:MixinExtras:0.0.12-gasstation") + compileOnly("com.falsepattern:gasstation-mc1.7.10:0.1.0:dev") compileOnly("com.falsepattern:json:0.4.1") compileOnly("org.tukaani:xz:1.9") testCompile("org.tukaani:xz:1.9") diff --git a/src/main/java/com/falsepattern/lib/internal/asm/IMixinPluginTransformer.java b/src/main/java/com/falsepattern/lib/internal/asm/IMixinPluginTransformer.java index 0fd7838..d6a3299 100644 --- a/src/main/java/com/falsepattern/lib/internal/asm/IMixinPluginTransformer.java +++ b/src/main/java/com/falsepattern/lib/internal/asm/IMixinPluginTransformer.java @@ -32,7 +32,7 @@ import java.util.List; public class IMixinPluginTransformer implements IClassNodeTransformer { private static final String CLASSNODE_MIXINBOOTER = "org/spongepowered/libraries/org/objectweb/asm/tree/ClassNode"; - private static final String CLASSNODE_SPONGEMIXINS = "org/spongepowered/asm/lib/tree/ClassNode"; + private static final String CLASSNODE_REGULAR = "org/spongepowered/asm/lib/tree/ClassNode"; private static final String IMIXINPLUGIN = Tags.GROUPNAME + ".mixin.IMixinPlugin"; private static final String IMIXINPLUGIN_INTERNAL = IMIXINPLUGIN.replace('.', '/'); private static final String IMIXINCONFIGPLUGIN_INTERNAL = "org/spongepowered/asm/mixin/extensibility/IMixinConfigPlugin"; @@ -57,18 +57,18 @@ public class IMixinPluginTransformer implements IClassNodeTransformer { } private static void transformIMixinPlugin(ClassNode cn) { - if (!MixinInfo.isMixinBooterLegacy()) { - FPTransformer.LOG.info("Could not detect MixinBooterLegacy. Converting IMixinPlugin to legacy compat mode."); - doRename(cn.methods, CLASSNODE_MIXINBOOTER, CLASSNODE_SPONGEMIXINS); + if (MixinInfo.isMixinBooterLegacy()) { + FPTransformer.LOG.info("Detected MixinBooterLegacy. Converting IMixinPlugin to compat mode."); + doRename(cn.methods, CLASSNODE_REGULAR, CLASSNODE_MIXINBOOTER); } } private static void transformPlugin(ClassNode cn, String transformedName) { FPTransformer.LOG.info("Transforming " + transformedName + " to fit current mixin environment."); if (!MixinInfo.isMixinBooterLegacy()) { - doRename(cn.methods, CLASSNODE_MIXINBOOTER, CLASSNODE_SPONGEMIXINS); + doRename(cn.methods, CLASSNODE_MIXINBOOTER, CLASSNODE_REGULAR); } else { - doRename(cn.methods, CLASSNODE_SPONGEMIXINS, CLASSNODE_MIXINBOOTER); + doRename(cn.methods, CLASSNODE_REGULAR, CLASSNODE_MIXINBOOTER); } } diff --git a/src/main/java/com/falsepattern/lib/mixin/IMixinPlugin.java b/src/main/java/com/falsepattern/lib/mixin/IMixinPlugin.java index 441abda..41eca8d 100644 --- a/src/main/java/com/falsepattern/lib/mixin/IMixinPlugin.java +++ b/src/main/java/com/falsepattern/lib/mixin/IMixinPlugin.java @@ -21,13 +21,13 @@ package com.falsepattern.lib.mixin; import com.falsepattern.lib.StableAPI; -import com.falsepattern.lib.mixin.stubpackage.org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; import com.falsepattern.lib.util.FileUtil; import lombok.val; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.spongepowered.asm.lib.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; import org.spongepowered.asm.mixin.extensibility.IMixinInfo; -import org.spongepowered.libraries.org.objectweb.asm.tree.ClassNode; import net.minecraft.launchwrapper.Launch; @@ -146,14 +146,14 @@ public interface IMixinPlugin extends IMixinConfigPlugin { return success; } - @Override @StableAPI.Expose(since = "__INTERNAL__") + @Override default void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { } - @Override @StableAPI.Expose(since = "__INTERNAL__") + @Override default void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { } diff --git a/src/main/java/com/falsepattern/lib/mixin/stubpackage/org/spongepowered/asm/mixin/extensibility/IMixinConfigPlugin.java b/src/main/java/com/falsepattern/lib/mixin/stubpackage/org/spongepowered/asm/mixin/extensibility/IMixinConfigPlugin.java deleted file mode 100644 index 450441f..0000000 --- a/src/main/java/com/falsepattern/lib/mixin/stubpackage/org/spongepowered/asm/mixin/extensibility/IMixinConfigPlugin.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of Mixin, licensed under the MIT License (MIT). - * - * Copyright (c) SpongePowered - * Copyright (c) contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.falsepattern.lib.mixin.stubpackage.org.spongepowered.asm.mixin.extensibility; - -import java.util.List; -import java.util.Set; - -import org.spongepowered.asm.mixin.extensibility.IMixinInfo; -import org.spongepowered.libraries.org.objectweb.asm.tree.ClassNode; - -public interface IMixinConfigPlugin { - void onLoad(String mixinPackage); - String getRefMapperConfig(); - boolean shouldApplyMixin(String targetClassName, String mixinClassName); - void acceptTargets(Set myTargets, Set otherTargets); - List getMixins(); - void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo); - void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo); -}