diff --git a/src/test/groovy/net/fabricmc/loom/test/unit/layeredmappings/LayeredMappingsSpecification.groovy b/src/test/groovy/net/fabricmc/loom/test/unit/layeredmappings/LayeredMappingsSpecification.groovy index 814f0f4..1042912 100644 --- a/src/test/groovy/net/fabricmc/loom/test/unit/layeredmappings/LayeredMappingsSpecification.groovy +++ b/src/test/groovy/net/fabricmc/loom/test/unit/layeredmappings/LayeredMappingsSpecification.groovy @@ -30,8 +30,11 @@ import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingSpec import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingsProcessor import net.fabricmc.loom.configuration.providers.mappings.MappingContext import net.fabricmc.loom.configuration.providers.mappings.MappingLayer +import net.fabricmc.loom.configuration.providers.mappings.MappingNamespace import net.fabricmc.loom.configuration.providers.mappings.MappingsProvider import net.fabricmc.loom.configuration.providers.mappings.MappingsSpec +import net.fabricmc.mappingio.adapter.MappingDstNsReorder +import net.fabricmc.mappingio.adapter.MappingSourceNsSwitch import net.fabricmc.mappingio.format.Tiny2Writer import net.fabricmc.mappingio.tree.MemoryMappingTree import org.gradle.api.logging.Logger @@ -89,6 +92,14 @@ abstract class LayeredMappingsSpecification extends Specification implements Lay return sw.toString() } + MemoryMappingTree reorder(MemoryMappingTree mappingTree) { + def reorderedMappings = new MemoryMappingTree() + def nsReorder = new MappingDstNsReorder(reorderedMappings, Collections.singletonList(MappingNamespace.NAMED.stringValue())) + def nsSwitch = new MappingSourceNsSwitch(nsReorder, MappingNamespace.INTERMEDIARY.stringValue(), true) + mappingTree.accept(nsSwitch) + return reorderedMappings + } + @CompileStatic class TestMappingContext implements MappingContext { @Override diff --git a/src/test/groovy/net/fabricmc/loom/test/unit/layeredmappings/ParchmentMappingLayerTest.groovy b/src/test/groovy/net/fabricmc/loom/test/unit/layeredmappings/ParchmentMappingLayerTest.groovy index 76bea3b..760019b 100644 --- a/src/test/groovy/net/fabricmc/loom/test/unit/layeredmappings/ParchmentMappingLayerTest.groovy +++ b/src/test/groovy/net/fabricmc/loom/test/unit/layeredmappings/ParchmentMappingLayerTest.groovy @@ -38,16 +38,18 @@ class ParchmentMappingLayerTest extends LayeredMappingsSpecification { def mappings = getLayeredMappings( new IntermediaryMappingsSpec(), new MojangMappingsSpec(), - new ParchmentMappingsSpec(PARCHMENT_NOTATION, false) + new ParchmentMappingsSpec(PARCHMENT_NOTATION, true) ) def tiny = getTiny(mappings) + def reorderedMappings = reorder(mappings) then: mappings.srcNamespace == "named" mappings.dstNamespaces == ["intermediary", "official"] mappings.classes.size() == 5747 mappings.classes[0].srcName.hashCode() == -1112444138 // MojMap name, just check the hash mappings.classes[0].getDstName(0) == "net/minecraft/class_2573" - mappings.classes[0].methods[0].args[0].srcName == "pStack" + mappings.classes[0].methods[0].args[0].srcName.hashCode() == 109757064 + reorderedMappings.getClass("net/minecraft/class_2573").getMethod("method_10913", "(Lnet/minecraft/class_1799;Lnet/minecraft/class_1767;)V").args.size() > 0 } def "Read parchment mappings remove prefix" () {