Fix mod obof, and add property to specify refmapName

dev/0.11
modmuss50 2016-10-20 16:55:46 +01:00
parent 14fb337330
commit 9f959ef04d
No known key found for this signature in database
GPG Key ID: 773D17BE8BF49C82
10 changed files with 172 additions and 175 deletions

View File

@ -57,7 +57,7 @@ dependencies {
shade 'commons-io:commons-io:1.4' shade 'commons-io:commons-io:1.4'
shade 'com.google.guava:guava:19.0' shade 'com.google.guava:guava:19.0'
shade 'net.fabricmc:weave:0.1.0.6' shade 'net.fabricmc:weave:0.1.0.6'
shade 'cuchaz:enigma:0.11.0.5:lib' shade 'cuchaz:enigma:0.11.0.19:lib'
shade 'net.fabricmc:tiny-remapper:+' shade 'net.fabricmc:tiny-remapper:+'
compile 'net.fabricmc:fabric-base:16w38a-0.0.4-SNAPSHOT' compile 'net.fabricmc:fabric-base:16w38a-0.0.4-SNAPSHOT'

View File

@ -30,14 +30,13 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import net.fabricmc.loom.task.DownloadTask; import net.fabricmc.loom.task.DownloadTask;
import net.fabricmc.loom.task.GenIdeaProjectTask; import net.fabricmc.loom.task.GenIdeaProjectTask;
import net.fabricmc.loom.util.ModRemapper;
import net.fabricmc.loom.util.Constants; import net.fabricmc.loom.util.Constants;
import net.fabricmc.loom.util.ModRemapper;
import net.fabricmc.loom.util.Version; import net.fabricmc.loom.util.Version;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.Task; import org.gradle.api.Task;
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; import org.gradle.api.artifacts.repositories.MavenArtifactRepository;
import org.gradle.api.internal.file.collections.FileCollectionAdapter;
import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSet;
@ -106,7 +105,7 @@ public class AbstractPlugin implements Plugin<Project> {
javaCompileTask.getOptions().getCompilerArgs().add("-AinMapFilePomfMojang=" + Constants.MAPPINGS_TINY.get(extension).getCanonicalPath()); javaCompileTask.getOptions().getCompilerArgs().add("-AinMapFilePomfMojang=" + Constants.MAPPINGS_TINY.get(extension).getCanonicalPath());
javaCompileTask.getOptions().getCompilerArgs().add("-AoutMapFilePomfMojang=" + Constants.MAPPINGS_MIXIN_EXPORT.get(extension).getCanonicalPath()); javaCompileTask.getOptions().getCompilerArgs().add("-AoutMapFilePomfMojang=" + Constants.MAPPINGS_MIXIN_EXPORT.get(extension).getCanonicalPath());
javaCompileTask.getOptions().getCompilerArgs().add("-AoutRefMapFile=" + new File(javaCompileTask.getDestinationDir(), ".mixin-refmap.json").getCanonicalPath()); javaCompileTask.getOptions().getCompilerArgs().add("-AoutRefMapFile=" + new File(javaCompileTask.getDestinationDir(), extension.refmapName).getCanonicalPath());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -267,7 +266,6 @@ public class AbstractPlugin implements Plugin<Project> {
}); });
}); });
} }
protected void readModJson(LoomGradleExtension extension) { protected void readModJson(LoomGradleExtension extension) {

View File

@ -33,6 +33,7 @@ public class LoomGradleExtension {
public String runDir = "run"; public String runDir = "run";
public String fabricVersion; public String fabricVersion;
public String pomfVersion; public String pomfVersion;
public String refmapName;
//Not to be set in the build.gradle //Not to be set in the build.gradle
public Project project; public Project project;

View File

@ -55,13 +55,13 @@ public class MixinMappingProviderTiny extends MappingProvider {
} }
} }
@Override @Override
public MappingMethod getMethodMapping(MappingMethod method) { public MappingMethod getMethodMapping(MappingMethod method) {
System.out.println("processing " + method.getName() + method.getDesc()); System.out.println("processing " + method.getName() + method.getDesc());
MappingMethod mapped = this.methodMap.get(method); MappingMethod mapped = this.methodMap.get(method);
if (mapped != null) return mapped; if (mapped != null)
return mapped;
try { try {
Class c = this.getClass().getClassLoader().loadClass(method.getOwner().replace('/', '.')); Class c = this.getClass().getClassLoader().loadClass(method.getOwner().replace('/', '.'));
@ -71,12 +71,14 @@ public class MixinMappingProviderTiny extends MappingProvider {
for (Class cc : c.getInterfaces()) { for (Class cc : c.getInterfaces()) {
mapped = getMethodMapping(method.move(cc.getName().replace('.', '/'))); mapped = getMethodMapping(method.move(cc.getName().replace('.', '/')));
if (mapped != null) return mapped; if (mapped != null)
return mapped;
} }
if (c.getSuperclass() != null) { if (c.getSuperclass() != null) {
mapped = getMethodMapping(method.move(c.getSuperclass().getName().replace('.', '/'))); mapped = getMethodMapping(method.move(c.getSuperclass().getName().replace('.', '/')));
if (mapped != null) return mapped; if (mapped != null)
return mapped;
} }
return null; return null;
@ -91,7 +93,8 @@ public class MixinMappingProviderTiny extends MappingProvider {
System.out.println("processing " + field.getOwner() + "/" + field.getName() + field.getDesc()); System.out.println("processing " + field.getOwner() + "/" + field.getName() + field.getDesc());
MappingField mapped = this.fieldMap.get(field); MappingField mapped = this.fieldMap.get(field);
if (mapped != null) return mapped; if (mapped != null)
return mapped;
try { try {
Class c = this.getClass().getClassLoader().loadClass(field.getOwner().replace('/', '.')); Class c = this.getClass().getClassLoader().loadClass(field.getOwner().replace('/', '.'));
@ -101,12 +104,14 @@ public class MixinMappingProviderTiny extends MappingProvider {
for (Class cc : c.getInterfaces()) { for (Class cc : c.getInterfaces()) {
mapped = getFieldMapping(field.move(cc.getName().replace('.', '/'))); mapped = getFieldMapping(field.move(cc.getName().replace('.', '/')));
if (mapped != null) return mapped; if (mapped != null)
return mapped;
} }
if (c.getSuperclass() != null) { if (c.getSuperclass() != null) {
mapped = getFieldMapping(field.move(c.getSuperclass().getName().replace('.', '/'))); mapped = getFieldMapping(field.move(c.getSuperclass().getName().replace('.', '/')));
if (mapped != null) return mapped; if (mapped != null)
return mapped;
} }
return null; return null;

View File

@ -29,9 +29,7 @@ import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.util.Constants; import net.fabricmc.loom.util.Constants;
import net.fabricmc.loom.util.IdeaRunConfig; import net.fabricmc.loom.util.IdeaRunConfig;
import net.fabricmc.loom.util.Version; import net.fabricmc.loom.util.Version;
import org.gradle.api.DefaultTask;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.tasks.TaskAction;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;

View File

@ -29,11 +29,7 @@ import cuchaz.enigma.TranslatingTypeLoader;
import cuchaz.enigma.mapping.MappingsEnigmaReader; import cuchaz.enigma.mapping.MappingsEnigmaReader;
import cuchaz.enigma.mapping.TranslationDirection; import cuchaz.enigma.mapping.TranslationDirection;
import cuchaz.enigma.throwables.MappingParseException; import cuchaz.enigma.throwables.MappingParseException;
import javassist.CtBehavior;
import javassist.CtClass; import javassist.CtClass;
import javassist.CtField;
import javassist.bytecode.AccessFlag;
import javassist.bytecode.InnerClassesAttribute;
import net.fabricmc.loom.LoomGradleExtension; import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.util.Constants; import net.fabricmc.loom.util.Constants;
import org.gradle.api.DefaultTask; import org.gradle.api.DefaultTask;
@ -64,7 +60,7 @@ public class MapJarsTask extends DefaultTask {
writeJar(Constants.MINECRAFT_MAPPED_JAR.get(extension), new ProgressListener(), deobfuscator); writeJar(Constants.MINECRAFT_MAPPED_JAR.get(extension), new ProgressListener(), deobfuscator);
File tempAssests = new File(Constants.CACHE_FILES, "tempAssets"); File tempAssests = new File(Constants.CACHE_FILES, "tempAssets");
if(tempAssests.exists()){ if (tempAssests.exists()) {
FileUtils.deleteDirectory(tempAssests); FileUtils.deleteDirectory(tempAssests);
} }
tempAssests.mkdir(); tempAssests.mkdir();

View File

@ -32,7 +32,6 @@ 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.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -64,7 +63,7 @@ public class ModRemapper {
classpathFiles.addAll(project.getConfigurations().getByName("compile").getFiles()); classpathFiles.addAll(project.getConfigurations().getByName("compile").getFiles());
classpathFiles.addAll(project.getConfigurations().getByName(Constants.CONFIG_MC_DEPENDENCIES_CLIENT).getFiles()); classpathFiles.addAll(project.getConfigurations().getByName(Constants.CONFIG_MC_DEPENDENCIES_CLIENT).getFiles());
classpathFiles.addAll(project.getConfigurations().getByName(Constants.CONFIG_MC_DEPENDENCIES).getFiles()); classpathFiles.addAll(project.getConfigurations().getByName(Constants.CONFIG_MC_DEPENDENCIES).getFiles());
classpathFiles.add(new File(Constants.MINECRAFT_MERGED_JAR.get(extension).getAbsolutePath()));//Seems to fix it not finding it classpathFiles.add(new File(Constants.MINECRAFT_FINAL_JAR.get(extension).getAbsolutePath()));//Seems to fix it not finding it
Path[] classpath = new Path[classpathFiles.size()]; Path[] classpath = new Path[classpathFiles.size()];
for (int i = 0; i < classpathFiles.size(); i++) { for (int i = 0; i < classpathFiles.size(); i++) {