Add reobf workaround back (Fixes #626)

This commit is contained in:
William Blake Galbreath
2021-08-29 11:49:58 -05:00
parent e72be60b16
commit 3f17a242fa

View File

@@ -0,0 +1,46 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Wed, 30 Jun 2021 02:33:18 -0700
Subject: [PATCH] Apply paper's reobf mappings patch
diff --git a/build.gradle.kts b/build.gradle.kts
index 628ac56388882a1bcbeae37769a99e9ccb071f66..399641413d38f1a27165a0cf60b6c7c781cf1488 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -2,9 +2,12 @@ import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCach
import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer
import io.papermc.paperweight.tasks.BaseTask
import io.papermc.paperweight.util.Git
+import io.papermc.paperweight.util.cache
import io.papermc.paperweight.util.defaultOutput
import io.papermc.paperweight.util.openZip
import io.papermc.paperweight.util.path
+import io.papermc.paperweight.util.registering
+import io.papermc.paperweight.util.set
import shadow.org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor.PLUGIN_CACHE_FILE
import java.nio.file.Files
import java.util.Locale
@@ -145,6 +148,22 @@ relocation {
}
}
+val generateReobfMappings = rootProject.tasks.named<io.papermc.paperweight.tasks.GenerateReobfMappings>("generateReobfMappings")
+
+val patchReobfMappings by tasks.registering<io.papermc.paperweight.tasks.PatchMappings> {
+ inputMappings.set(generateReobfMappings.flatMap { it.reobfMappings })
+ patch.set(rootProject.layout.cache.resolve("paperweight/upstreams/paper/build-data/reobf-mappings-patch.tiny"))
+
+ fromNamespace.set(io.papermc.paperweight.util.constants.DEOBF_NAMESPACE)
+ toNamespace.set(io.papermc.paperweight.util.constants.SPIGOT_NAMESPACE)
+
+ outputMappings.set(layout.cache.resolve("paperweight/mappings/reobf-patched.tiny"))
+}
+
+tasks.reobfJar {
+ mappingsFile.set(patchReobfMappings.flatMap { it.outputMappings })
+}
+
val generatePom = tasks.named<GenerateMavenPom>("generatePomFileForMavenPublication")
tasks.shadowJar {