Map mods to intermediary

dev/0.11
modmuss50 2018-10-31 13:20:50 +00:00
parent cbdb516d5b
commit 5ca71d9d15
4 changed files with 14 additions and 11 deletions

View File

@ -103,14 +103,14 @@ public class AbstractPlugin implements Plugin<Project> {
try { try {
javaCompileTask.getClasspath().add(target.files(this.getClass().getProtectionDomain().getCodeSource().getLocation())); javaCompileTask.getClasspath().add(target.files(this.getClass().getProtectionDomain().getCodeSource().getLocation()));
javaCompileTask.getOptions().getCompilerArgs().add("-AinMapFilePomfMojang=" + Constants.MAPPINGS_TINY.get(extension).getCanonicalPath()); javaCompileTask.getOptions().getCompilerArgs().add("-AinMapFilePomfIntermediary=" + Constants.MAPPINGS_TINY.get(extension).getCanonicalPath());
javaCompileTask.getOptions().getCompilerArgs().add("-AoutMapFilePomfMojang=" + Constants.MAPPINGS_MIXIN_EXPORT.get(extension).getCanonicalPath()); javaCompileTask.getOptions().getCompilerArgs().add("-AoutMapFilePomfIntermediary=" + Constants.MAPPINGS_MIXIN_EXPORT.get(extension).getCanonicalPath());
if(extension.refmapName == null || extension.refmapName.isEmpty()){ if(extension.refmapName == null || extension.refmapName.isEmpty()){
project.getLogger().error("Could not find refmap definition, will be using default name: " + project.getName() + "-refmap.json"); project.getLogger().error("Could not find refmap definition, will be using default name: " + project.getName() + "-refmap.json");
extension.refmapName = project.getName() + "-refmap.json"; extension.refmapName = project.getName() + "-refmap.json";
} }
javaCompileTask.getOptions().getCompilerArgs().add("-AoutRefMapFile=" + new File(javaCompileTask.getDestinationDir(), extension.refmapName).getCanonicalPath()); javaCompileTask.getOptions().getCompilerArgs().add("-AoutRefMapFile=" + new File(javaCompileTask.getDestinationDir(), extension.refmapName).getCanonicalPath());
javaCompileTask.getOptions().getCompilerArgs().add("-AdefaultObfuscationEnv=pomf:mojang"); javaCompileTask.getOptions().getCompilerArgs().add("-AdefaultObfuscationEnv=pomf:intermediary");
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -60,16 +60,16 @@ public class ObfuscationServiceFabric implements IObfuscationService {
@Override @Override
public Set<String> getSupportedOptions() { public Set<String> getSupportedOptions() {
ImmutableSet.Builder builder = new ImmutableSet.Builder(); ImmutableSet.Builder builder = new ImmutableSet.Builder();
addSupportedOptions(builder, "mojang", "pomf"); addSupportedOptions(builder, "intermediary", "pomf");
addSupportedOptions(builder, "pomf", "mojang"); addSupportedOptions(builder, "pomf", "intermediary");
return builder.build(); return builder.build();
} }
@Override @Override
public Collection<ObfuscationTypeDescriptor> getObfuscationTypes() { public Collection<ObfuscationTypeDescriptor> getObfuscationTypes() {
return ImmutableSet.of( return ImmutableSet.of(
createObfuscationType("mojang", "pomf"), createObfuscationType("intermediary", "pomf"),
createObfuscationType("pomf", "mojang") createObfuscationType("pomf", "intermediary")
); );
} }
} }

View File

@ -59,7 +59,7 @@ public class ModProccessor {
private static void remapJar(File input, File output, Project project){ private static void remapJar(File input, File output, Project project){
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
String fromM = "mojang"; String fromM = "intermediary";
String toM = "pomf"; String toM = "pomf";
Path mappings = Constants.MAPPINGS_TINY.get(extension).toPath(); Path mappings = Constants.MAPPINGS_TINY.get(extension).toPath();

View File

@ -25,14 +25,17 @@
package net.fabricmc.loom.util; package net.fabricmc.loom.util;
import net.fabricmc.loom.LoomGradleExtension; import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.tinyremapper.*; import net.fabricmc.tinyremapper.OutputConsumerPath;
import net.fabricmc.tinyremapper.TinyRemapper;
import net.fabricmc.tinyremapper.TinyUtils;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.gradle.api.Project; import org.gradle.api.Project;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.*; import java.util.ArrayList;
import java.util.List;
public class ModRemapper { public class ModRemapper {
@ -60,7 +63,7 @@ public class ModRemapper {
Path mappings = Constants.MAPPINGS_TINY.get(extension).toPath(); Path mappings = Constants.MAPPINGS_TINY.get(extension).toPath();
String fromM = "pomf"; String fromM = "pomf";
String toM = "mojang"; String toM = "intermediary";
List<File> classpathFiles = new ArrayList<>(); List<File> classpathFiles = new ArrayList<>();
classpathFiles.addAll(project.getConfigurations().getByName("compile").getFiles()); classpathFiles.addAll(project.getConfigurations().getByName("compile").getFiles());