Skip to content

Commit

Permalink
Update MIO to 0.5.0 (#974)
Browse files Browse the repository at this point in the history
* Update MIO to 0.5.0

* Beta 3 + fix
  • Loading branch information
modmuss50 authored Nov 6, 2023
1 parent ee0e5df commit 83ab524
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ guava = "32.1.2-jre"
stitch = "0.6.2"
tiny-remapper = "0.8.11"
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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -99,7 +99,7 @@ private void writeMapping(LayeredMappingsProcessor processor, List<MappingLayer>
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/fabricmc/loom/task/GenerateSourcesTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()
}

Expand Down

0 comments on commit 83ab524

Please sign in to comment.