Revert "update tiny-remapper"

This reverts commit d779225508.
dev/0.11
Adrian Siekierka 2019-04-13 12:46:55 +02:00
parent d779225508
commit 52a8f7374e
3 changed files with 32 additions and 44 deletions

View File

@ -37,13 +37,12 @@ dependencies {
implementation ('net.fabricmc:stitch:0.1.2.47') { implementation ('net.fabricmc:stitch:0.1.2.47') {
exclude module: 'enigma' exclude module: 'enigma'
} }
implementation ('net.fabricmc:tiny-remapper:0.1.0.32') { implementation ('net.fabricmc:tiny-remapper:0.1.0.29') {
transitive = false transitive = false
} }
implementation ('net.fabricmc:tiny-mappings-parser:0.1.1.8') implementation ('org.jetbrains:intellij-fernflower:1.0.0.7')
implementation ('org.jetbrains:intellij-fernflower:1.0.0.8')
implementation ('net.fabricmc:sponge-mixin:0.7.11.19') { implementation ('net.fabricmc:sponge-mixin:0.7.11.17') {
exclude module: 'launchwrapper' exclude module: 'launchwrapper'
exclude module: 'guava' exclude module: 'guava'
} }

View File

@ -24,7 +24,7 @@
package net.fabricmc.loom.mixin; package net.fabricmc.loom.mixin;
import net.fabricmc.mappings.*; import net.fabricmc.tinyremapper.TinyUtils;
import org.spongepowered.asm.obfuscation.mapping.common.MappingField; import org.spongepowered.asm.obfuscation.mapping.common.MappingField;
import org.spongepowered.asm.obfuscation.mapping.common.MappingMethod; import org.spongepowered.asm.obfuscation.mapping.common.MappingMethod;
import org.spongepowered.tools.obfuscation.mapping.common.MappingProvider; import org.spongepowered.tools.obfuscation.mapping.common.MappingProvider;
@ -33,7 +33,6 @@ import javax.annotation.processing.Filer;
import javax.annotation.processing.Messager; import javax.annotation.processing.Messager;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
@ -46,6 +45,16 @@ public class MixinMappingProviderTiny extends MappingProvider {
this.to = to; this.to = to;
} }
private static String[] removeFirst(String[] src, int count) {
if (count >= src.length) {
return new String[0];
} else {
String[] out = new String[src.length - count];
System.arraycopy(src, count, out, 0, out.length);
return out;
}
}
@Override @Override
public MappingMethod getMethodMapping(MappingMethod method) { public MappingMethod getMethodMapping(MappingMethod method) {
MappingMethod mapped = this.methodMap.get(method); MappingMethod mapped = this.methodMap.get(method);
@ -110,34 +119,22 @@ public class MixinMappingProviderTiny extends MappingProvider {
} */ } */
} }
// TODO: Unify with tiny-remapper
@Override @Override
public void read(File input) throws IOException { public void read(File input) throws IOException {
try (FileInputStream inputStream = new FileInputStream(input)) { BufferedReader reader = Files.newBufferedReader(input.toPath());
Mappings mappings = MappingsProvider.readTinyMappings(inputStream, false);
for (ClassEntry entry : mappings.getClassEntries()) { TinyUtils.read(reader, from, to, classMap::put, (fieldFrom, fieldTo) -> {
classMap.put(entry.get(from), entry.get(to)); fieldMap.put(
} new MappingField(fieldFrom.owner, fieldFrom.name, fieldFrom.desc),
new MappingField(fieldTo.owner, fieldTo.name, fieldTo.desc)
for (FieldEntry entry : mappings.getFieldEntries()) { );
EntryTriple fromTriple = entry.get(from); }, (methodFrom, methodTo) -> {
EntryTriple toTriple = entry.get(to); methodMap.put(
new MappingMethod(methodFrom.owner, methodFrom.name, methodFrom.desc),
fieldMap.put( new MappingMethod(methodTo.owner, methodTo.name, methodTo.desc)
new MappingField(fromTriple.getOwner(), fromTriple.getName(), fromTriple.getDesc()), );
new MappingField(toTriple.getOwner(), toTriple.getName(), toTriple.getDesc()) });
);
}
for (MethodEntry entry : mappings.getMethodEntries()) {
EntryTriple fromTriple = entry.get(from);
EntryTriple toTriple = entry.get(to);
methodMap.put(
new MappingMethod(fromTriple.getOwner(), fromTriple.getName(), fromTriple.getDesc()),
new MappingMethod(toTriple.getOwner(), toTriple.getName(), toTriple.getDesc())
);
}
}
} }
} }

View File

@ -24,7 +24,6 @@
package net.fabricmc.loom.task; package net.fabricmc.loom.task;
import net.fabricmc.fernflower.api.IFabricResultSaver;
import org.jetbrains.java.decompiler.main.decompiler.BaseDecompiler; import org.jetbrains.java.decompiler.main.decompiler.BaseDecompiler;
import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler; import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler;
import org.jetbrains.java.decompiler.main.extern.IBytecodeProvider; import org.jetbrains.java.decompiler.main.extern.IBytecodeProvider;
@ -38,7 +37,7 @@ import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream; import java.util.jar.JarOutputStream;
import java.util.jar.Manifest; import java.util.jar.Manifest;
public class LoomFernflowerDecompiler extends ConsoleDecompiler implements IFabricResultSaver { public class LoomFernflowerDecompiler extends ConsoleDecompiler {
private final Map<String, int[]> differingMappings = new HashMap<>(); private final Map<String, int[]> differingMappings = new HashMap<>();
private final String jarName; private final String jarName;
@ -84,19 +83,12 @@ public class LoomFernflowerDecompiler extends ConsoleDecompiler implements IFabr
} }
@Override @Override
public void saveClassEntry(String path, String archiveName, String qualifiedName, String entryName, String content, int[] mapping) { public void saveClassEntry(String s, String s1, String s2, String s3, String s4, int[] mapping) {
if (mapping != null) { if (mapping != null) {
differingMappings.put(qualifiedName, mapping); differingMappings.put(s2, mapping);
} }
super.saveClassEntry(path, jarName, qualifiedName, entryName, content); super.saveClassEntry(s, jarName, s2, s3, s4, mapping);
}
@Override
public void saveClassEntry(String path, String archiveName, String qualifiedName, String entryName, String content) {
System.err.println("WARNING: Called saveClassEntry without mapping! " + qualifiedName);
super.saveClassEntry(path, jarName, qualifiedName, entryName, content);
} }
@Override @Override