diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 08e91098d..914713fe3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,7 +9,7 @@ guava = "32.1.2-jre" stitch = "0.6.2" tiny-remapper = "0.8.9" access-widener = "2.1.0" -mapping-io = "0.4.2" +mapping-io = "0.5.0-beta.3" lorenz-tiny = "4.0.2" mercury = "0.4.0" kotlinx-metadata = "0.7.0" diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/IntermediateMappingsService.java b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/IntermediateMappingsService.java index d605ea27c..80171fa16 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/IntermediateMappingsService.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/IntermediateMappingsService.java @@ -45,7 +45,7 @@ import net.fabricmc.loom.util.service.SharedService; import net.fabricmc.loom.util.service.SharedServiceManager; import net.fabricmc.mappingio.adapter.MappingNsCompleter; -import net.fabricmc.mappingio.format.Tiny2Reader; +import net.fabricmc.mappingio.format.tiny.Tiny2FileReader; import net.fabricmc.mappingio.tree.MemoryMappingTree; public final class IntermediateMappingsService implements SharedService { @@ -90,7 +90,7 @@ private MemoryMappingTree createMemoryMappingTree() { MappingNsCompleter nsCompleter = new MappingNsCompleter(tree, Collections.singletonMap(MappingsNamespace.NAMED.toString(), MappingsNamespace.INTERMEDIARY.toString()), true); try (BufferedReader reader = Files.newBufferedReader(getIntermediaryTiny(), StandardCharsets.UTF_8)) { - Tiny2Reader.read(reader, nsCompleter); + Tiny2FileReader.read(reader, nsCompleter); } } catch (IOException e) { throw new UncheckedIOException("Failed to read intermediary mappings", e); diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/LayeredMappingsDependency.java b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/LayeredMappingsDependency.java index 4ce75ef73..c912bbe89 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/LayeredMappingsDependency.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/LayeredMappingsDependency.java @@ -53,7 +53,7 @@ import net.fabricmc.loom.util.ZipUtils; import net.fabricmc.mappingio.adapter.MappingDstNsReorder; import net.fabricmc.mappingio.adapter.MappingSourceNsSwitch; -import net.fabricmc.mappingio.format.Tiny2Writer; +import net.fabricmc.mappingio.format.tiny.Tiny2FileWriter; import net.fabricmc.mappingio.tree.MemoryMappingTree; public class LayeredMappingsDependency implements SelfResolvingDependency, FileCollectionDependency { @@ -99,7 +99,7 @@ private void writeMapping(LayeredMappingsProcessor processor, List MemoryMappingTree mappings = processor.getMappings(layers); try (Writer writer = new StringWriter()) { - Tiny2Writer tiny2Writer = new Tiny2Writer(writer, false); + var tiny2Writer = new Tiny2FileWriter(writer, false); MappingDstNsReorder nsReorder = new MappingDstNsReorder(tiny2Writer, Collections.singletonList(MappingsNamespace.NAMED.toString())); MappingSourceNsSwitch nsSwitch = new MappingSourceNsSwitch(nsReorder, MappingsNamespace.INTERMEDIARY.toString(), true); diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingConfiguration.java b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingConfiguration.java index 8321d3dec..317d4d364 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingConfiguration.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingConfiguration.java @@ -193,7 +193,7 @@ private void storeMappings(Project project, SharedServiceManager serviceManager, private static boolean areMappingsV2(Path path) throws IOException { try (BufferedReader reader = Files.newBufferedReader(path)) { - return MappingReader.detectFormat(reader) == MappingFormat.TINY_2; + return MappingReader.detectFormat(reader) == MappingFormat.TINY_2_FILE; } } diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/file/FileMappingsLayer.java b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/file/FileMappingsLayer.java index 06b79461b..2d6dd61aa 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/file/FileMappingsLayer.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/file/FileMappingsLayer.java @@ -78,7 +78,7 @@ private void visit(Path path, MappingVisitor mappingVisitor) throws IOException ); MappingNsRenamer renamer = new MappingNsRenamer(nsSwitch, fallbackNamespaceReplacements); - MappingReader.read(path, enigma ? MappingFormat.ENIGMA : null, renamer); + MappingReader.read(path, enigma ? MappingFormat.ENIGMA_DIR : null, renamer); } @Override diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/mojmap/MojangMappingLayer.java b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/mojmap/MojangMappingLayer.java index 580c39dcc..cd37bc01b 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/mojmap/MojangMappingLayer.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/mojmap/MojangMappingLayer.java @@ -40,7 +40,7 @@ import net.fabricmc.loom.configuration.providers.mappings.utils.DstNameFilterMappingVisitor; import net.fabricmc.mappingio.MappingVisitor; import net.fabricmc.mappingio.adapter.MappingSourceNsSwitch; -import net.fabricmc.mappingio.format.ProGuardReader; +import net.fabricmc.mappingio.format.proguard.ProGuardFileReader; public record MojangMappingLayer(Path clientMappings, Path serverMappings, boolean nameSyntheticMembers, Logger logger) implements MappingLayer { @@ -58,8 +58,8 @@ public void visit(MappingVisitor mappingVisitor) throws IOException { try (BufferedReader clientBufferedReader = Files.newBufferedReader(clientMappings, StandardCharsets.UTF_8); BufferedReader serverBufferedReader = Files.newBufferedReader(serverMappings, StandardCharsets.UTF_8)) { - ProGuardReader.read(clientBufferedReader, MappingsNamespace.NAMED.toString(), MappingsNamespace.OFFICIAL.toString(), nsSwitch); - ProGuardReader.read(serverBufferedReader, MappingsNamespace.NAMED.toString(), MappingsNamespace.OFFICIAL.toString(), nsSwitch); + ProGuardFileReader.read(clientBufferedReader, MappingsNamespace.NAMED.toString(), MappingsNamespace.OFFICIAL.toString(), nsSwitch); + ProGuardFileReader.read(serverBufferedReader, MappingsNamespace.NAMED.toString(), MappingsNamespace.OFFICIAL.toString(), nsSwitch); } } diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/tiny/MappingsMerger.java b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/tiny/MappingsMerger.java index 5988f143d..db845663b 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/tiny/MappingsMerger.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/tiny/MappingsMerger.java @@ -41,8 +41,8 @@ import net.fabricmc.loom.configuration.providers.mappings.IntermediateMappingsService; import net.fabricmc.mappingio.adapter.MappingNsCompleter; import net.fabricmc.mappingio.adapter.MappingSourceNsSwitch; -import net.fabricmc.mappingio.format.Tiny2Reader; -import net.fabricmc.mappingio.format.Tiny2Writer; +import net.fabricmc.mappingio.format.tiny.Tiny2FileReader; +import net.fabricmc.mappingio.format.tiny.Tiny2FileWriter; import net.fabricmc.mappingio.tree.MappingTree; import net.fabricmc.mappingio.tree.MemoryMappingTree; @@ -57,7 +57,7 @@ public static void mergeAndSaveMappings(Path from, Path out, IntermediateMapping intermediateMappingsService.getMemoryMappingTree().accept(new MappingSourceNsSwitch(intermediaryTree, MappingsNamespace.INTERMEDIARY.toString())); try (BufferedReader reader = Files.newBufferedReader(from, StandardCharsets.UTF_8)) { - Tiny2Reader.read(reader, intermediaryTree); + Tiny2FileReader.read(reader, intermediaryTree); } MemoryMappingTree officialTree = new MemoryMappingTree(); @@ -67,7 +67,7 @@ public static void mergeAndSaveMappings(Path from, Path out, IntermediateMapping inheritMappedNamesOfEnclosingClasses(officialTree); - try (Tiny2Writer writer = new Tiny2Writer(Files.newBufferedWriter(out, StandardCharsets.UTF_8), false)) { + try (var writer = new Tiny2FileWriter(Files.newBufferedWriter(out, StandardCharsets.UTF_8), false)) { officialTree.accept(writer); } diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/tiny/TinyJarInfo.java b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/tiny/TinyJarInfo.java index 692883ac7..8ea1efc11 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/tiny/TinyJarInfo.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/tiny/TinyJarInfo.java @@ -47,7 +47,7 @@ public static TinyJarInfo get(Path jar) { private static boolean doesJarContainV2Mappings(Path path) throws IOException { try (FileSystemUtil.Delegate delegate = FileSystemUtil.getJarFileSystem(path)) { try (BufferedReader reader = Files.newBufferedReader(delegate.fs().getPath("mappings", "mappings.tiny"))) { - return MappingReader.detectFormat(reader) == MappingFormat.TINY_2; + return MappingReader.detectFormat(reader) == MappingFormat.TINY_2_FILE; } } } diff --git a/src/main/java/net/fabricmc/loom/task/GenerateSourcesTask.java b/src/main/java/net/fabricmc/loom/task/GenerateSourcesTask.java index 3445fbfd7..51850533e 100644 --- a/src/main/java/net/fabricmc/loom/task/GenerateSourcesTask.java +++ b/src/main/java/net/fabricmc/loom/task/GenerateSourcesTask.java @@ -90,7 +90,7 @@ import net.fabricmc.loom.util.service.ScopedSharedServiceManager; import net.fabricmc.mappingio.MappingReader; import net.fabricmc.mappingio.adapter.MappingSourceNsSwitch; -import net.fabricmc.mappingio.format.Tiny2Writer; +import net.fabricmc.mappingio.format.tiny.Tiny2FileWriter; import net.fabricmc.mappingio.tree.MemoryMappingTree; @DisableCachingByDefault @@ -483,7 +483,7 @@ private Path getMappings() { } try (Writer writer = Files.newBufferedWriter(outputMappings, StandardCharsets.UTF_8)) { - Tiny2Writer tiny2Writer = new Tiny2Writer(writer, false); + var tiny2Writer = new Tiny2FileWriter(writer, false); mappingTree.accept(new MappingSourceNsSwitch(tiny2Writer, MappingsNamespace.NAMED.toString())); } catch (IOException e) { throw new RuntimeException("Failed to write mappings", e); 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 17273f229..629167e9b 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 @@ -48,7 +48,7 @@ import net.fabricmc.loom.util.download.Download import net.fabricmc.loom.util.download.DownloadBuilder import net.fabricmc.mappingio.adapter.MappingDstNsReorder import net.fabricmc.mappingio.adapter.MappingSourceNsSwitch -import net.fabricmc.mappingio.format.Tiny2Writer +import net.fabricmc.mappingio.format.tiny.Tiny2FileWriter import net.fabricmc.mappingio.tree.MemoryMappingTree abstract class LayeredMappingsSpecification extends Specification implements LayeredMappingsTestConstants { @@ -102,7 +102,7 @@ abstract class LayeredMappingsSpecification extends Specification implements Lay String getTiny(MemoryMappingTree mappingTree) { def sw = new StringWriter() - mappingTree.accept(new Tiny2Writer(sw, false)) + mappingTree.accept(new Tiny2FileWriter(sw, false)) return sw.toString() }