From c542ccd23ee98955b3798752a919442623e67fe0 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sat, 1 Jan 2022 12:36:05 -0500 Subject: [PATCH] cooking by the book --- build.gradle.kts | 24 ++++++++++++------- .../skytilsmod/mixins/SkytilsMixinPlugin.kt | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c79bd83e0..6baffff69 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,7 +25,6 @@ plugins { kotlin("jvm") version "1.6.10" id("net.minecraftforge.gradle.forge") version "6f5327" id("com.github.johnrengelman.shadow") version "6.1.0" - id("org.spongepowered.mixin") version "d5f9873d60" java } @@ -64,8 +63,8 @@ val shadowMe: Configuration by configurations.creating { } dependencies { - annotationProcessor("org.spongepowered:mixin:0.7.11-SNAPSHOT") - implementation("org.spongepowered:mixin:0.7.11-SNAPSHOT") + annotationProcessor("org.spongepowered:mixin:0.8.5:processor") + compileOnly("org.spongepowered:mixin:0.8.5") shadowMe("gg.essential:loader-launchwrapper:1.1.3") implementation("gg.essential:essential-1.8.9-forge:1733") { @@ -92,15 +91,11 @@ dependencies { } } -mixin { - disableRefMapWarning = true - defaultObfuscationEnv = searge - add(sourceSets.main.get(), "mixins.skytils.refmap.json") -} +val mixinSrg = File(project.buildDir, "tmp/mixins/mixins.srg") +val mixinRefMap = File(project.buildDir, "tmp/mixins/mixins.skytils.refmap.json") sourceSets { main { - ext["refmap"] = "mixins.skytils.refmap.json" output.setResourcesDir(file("${buildDir}/classes/kotlin/main")) } } @@ -122,6 +117,10 @@ tasks { expand(mapOf("version" to project.version, "mcversion" to project.minecraft.version)) } } + val copySrg = register("copySrg") { + from(genSrgs.get().mcpToSrg) + into("build") + } named("jar") { archiveBaseName.set("Skytils") manifest { @@ -168,6 +167,12 @@ tasks { } withType { options.encoding = "UTF-8" + options.compilerArgs.addAll(arrayOf( + "-AoutSrgFile=${mixinSrg.canonicalPath}", + "-AoutRefMapFile=${mixinRefMap.canonicalPath}", + "-AreobfSrgFile=${project.file("build/mcp-srg.srg").canonicalPath}" + )) + dependsOn(copySrg.get()) } withType { kotlinOptions { @@ -181,6 +186,7 @@ tasks { } named("reobfShadowJar") { mustRunAfter(shadowJar) + addSecondarySrgFile(mixinSrg) } } diff --git a/src/main/kotlin/skytils/skytilsmod/mixins/SkytilsMixinPlugin.kt b/src/main/kotlin/skytils/skytilsmod/mixins/SkytilsMixinPlugin.kt index f01c688d5..dd761190e 100644 --- a/src/main/kotlin/skytils/skytilsmod/mixins/SkytilsMixinPlugin.kt +++ b/src/main/kotlin/skytils/skytilsmod/mixins/SkytilsMixinPlugin.kt @@ -19,7 +19,7 @@ package skytils.skytilsmod.mixins import net.minecraft.launchwrapper.Launch -import org.spongepowered.asm.lib.tree.ClassNode +import org.objectweb.asm.tree.ClassNode import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin import org.spongepowered.asm.mixin.extensibility.IMixinInfo