Initial untested support for mixin remapping
parent
68cd938036
commit
3ebbd9463c
|
@ -40,6 +40,7 @@ import org.gradle.api.artifacts.repositories.MavenArtifactRepository;
|
||||||
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;
|
||||||
|
import org.gradle.api.tasks.compile.JavaCompile;
|
||||||
import org.gradle.api.tasks.javadoc.Javadoc;
|
import org.gradle.api.tasks.javadoc.Javadoc;
|
||||||
import org.gradle.plugins.ide.eclipse.model.EclipseModel;
|
import org.gradle.plugins.ide.eclipse.model.EclipseModel;
|
||||||
import org.gradle.plugins.ide.idea.model.IdeaModel;
|
import org.gradle.plugins.ide.idea.model.IdeaModel;
|
||||||
|
@ -51,6 +52,8 @@ import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class AbstractPlugin implements Plugin<Project> {
|
public class AbstractPlugin implements Plugin<Project> {
|
||||||
protected Project project;
|
protected Project project;
|
||||||
|
@ -87,27 +90,28 @@ public class AbstractPlugin implements Plugin<Project> {
|
||||||
configureIDEs();
|
configureIDEs();
|
||||||
configureCompile();
|
configureCompile();
|
||||||
|
|
||||||
//TODO wait for AP thing
|
Map<Project, Set<Task>> taskMap = project.getAllTasks(true);
|
||||||
// Map<Project, Set<Task>> taskMap = project.getAllTasks(true);
|
for (Map.Entry<Project, Set<Task>> entry : taskMap.entrySet()) {
|
||||||
// for (Map.Entry<Project, Set<Task>> entry : taskMap.entrySet()) {
|
Project project = entry.getKey();
|
||||||
// Project project = entry.getKey();
|
Set<Task> taskSet = entry.getValue();
|
||||||
// Set<Task> taskSet = entry.getValue();
|
for (Task task : taskSet) {
|
||||||
// for (Task task : taskSet) {
|
if (task instanceof JavaCompile) {
|
||||||
// if (task instanceof JavaCompile) {
|
JavaCompile javaCompileTask = (JavaCompile) task;
|
||||||
// JavaCompile javaCompileTask = (JavaCompile) task;
|
javaCompileTask.doFirst(task1 -> {
|
||||||
// javaCompileTask.doFirst(task1 -> {
|
project.getLogger().lifecycle(":setting java compiler args");
|
||||||
// project.getLogger().lifecycle(":setting java compiler args");
|
try {
|
||||||
// try {
|
javaCompileTask.getOptions().getCompilerArgs().add("-AinMapFile=" + Constants.MAPPINGS_TINY.get(extension).getCanonicalPath());
|
||||||
// javaCompileTask.getOptions().getCompilerArgs().add("-AreobfNotchSrgFile=" + Constants.MAPPINGS_SRG.get(extension).getCanonicalPath());
|
javaCompileTask.getOptions().getCompilerArgs().add("-AoutMapFile=" + Constants.MAPPINGS_TINY.get(extension).getCanonicalPath());
|
||||||
// javaCompileTask.getOptions().getCompilerArgs().add("-AdefaultObfuscationEnv=notch");
|
javaCompileTask.getOptions().getCompilerArgs().add("-AoutRefMapFile=" + Constants.REF_MAP.get(extension).getCanonicalPath());
|
||||||
// } catch (IOException e) {
|
javaCompileTask.getOptions().getCompilerArgs().add("-AdefaultObfuscationEnv=mojang"); //TODO check if this should be pomf?
|
||||||
// e.printStackTrace();
|
} catch (IOException e) {
|
||||||
// }
|
e.printStackTrace();
|
||||||
// });
|
}
|
||||||
// }
|
});
|
||||||
// }
|
}
|
||||||
//
|
}
|
||||||
// }
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,11 @@ import org.gradle.api.artifacts.dsl.DependencyHandler;
|
||||||
import org.gradle.api.logging.Logger;
|
import org.gradle.api.logging.Logger;
|
||||||
import org.gradle.api.tasks.TaskAction;
|
import org.gradle.api.tasks.TaskAction;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.*;
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
public class DownloadTask extends DefaultTask {
|
public class DownloadTask extends DefaultTask {
|
||||||
@TaskAction
|
@TaskAction
|
||||||
|
@ -78,6 +77,22 @@ public class DownloadTask extends DefaultTask {
|
||||||
FileUtils.copyURLToFile(new URL("http://asie.pl:8080/job/pomf/" + extension.pomfVersion + "/artifact/build/libs/pomf-enigma-" + extension.version + "." + extension.pomfVersion + ".zip"), Constants.MAPPINGS_ZIP.get(extension));
|
FileUtils.copyURLToFile(new URL("http://asie.pl:8080/job/pomf/" + extension.pomfVersion + "/artifact/build/libs/pomf-enigma-" + extension.version + "." + extension.pomfVersion + ".zip"), Constants.MAPPINGS_ZIP.get(extension));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Constants.MAPPINGS_TINY.get(extension).exists()) {
|
||||||
|
if (!Constants.MAPPINGS_TINY_GZ.get(extension).exists()) {
|
||||||
|
getLogger().lifecycle(":downloading tiny mappings");
|
||||||
|
FileUtils.copyURLToFile(new URL("http://asie.pl:8080/job/pomf/" + extension.pomfVersion + "/artifact/build/libs/pomf-tiny-" + extension.version + "." + extension.pomfVersion + ".gz"), Constants.MAPPINGS_TINY_GZ.get(extension));
|
||||||
|
}
|
||||||
|
GZIPInputStream gzipInputStream = new GZIPInputStream(new FileInputStream(Constants.MAPPINGS_TINY_GZ.get(extension)));
|
||||||
|
FileOutputStream fileOutputStream = new FileOutputStream(Constants.MAPPINGS_TINY.get(extension));
|
||||||
|
int length;
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
while ((length = gzipInputStream.read(buffer)) > 0) {
|
||||||
|
fileOutputStream.write(buffer, 0, length);
|
||||||
|
}
|
||||||
|
gzipInputStream.close();
|
||||||
|
fileOutputStream.close();
|
||||||
|
}
|
||||||
|
|
||||||
DependencyHandler dependencyHandler = getProject().getDependencies();
|
DependencyHandler dependencyHandler = getProject().getDependencies();
|
||||||
|
|
||||||
if (getProject().getConfigurations().getByName(Constants.CONFIG_MC_DEPENDENCIES).getState() == Configuration.State.UNRESOLVED) {
|
if (getProject().getConfigurations().getByName(Constants.CONFIG_MC_DEPENDENCIES).getState() == Configuration.State.UNRESOLVED) {
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class Constants {
|
||||||
public static final IDelayed<File> MAPPINGS_DIR = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-enigma-" + extension.version + "." + extension.pomfVersion + ""));
|
public static final IDelayed<File> MAPPINGS_DIR = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-enigma-" + extension.version + "." + extension.pomfVersion + ""));
|
||||||
public static final IDelayed<File> MAPPINGS_TINY_GZ = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-tiny-" + extension.version + "." + extension.pomfVersion + ".gz"));
|
public static final IDelayed<File> MAPPINGS_TINY_GZ = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-tiny-" + extension.version + "." + extension.pomfVersion + ".gz"));
|
||||||
public static final IDelayed<File> MAPPINGS_TINY = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-tiny-" + extension.version + "." + extension.pomfVersion));
|
public static final IDelayed<File> MAPPINGS_TINY = new DelayedFile(extension -> new File(POMF_DIR.get(extension), "pomf-tiny-" + extension.version + "." + extension.pomfVersion));
|
||||||
|
public static final IDelayed<File> MAPPINGS_MIXIN_EXPORT = new DelayedFile(extension -> new File(extension.getFabricUserCache(), "pomf-tiny-mixin-" + extension.version + "." + extension.pomfVersion));
|
||||||
|
|
||||||
public static final IDelayed<File> REF_MAP = new DelayedFile(extension -> new File(WORKING_DIRECTORY, "RefMap.json"));
|
public static final IDelayed<File> REF_MAP = new DelayedFile(extension -> new File(WORKING_DIRECTORY, "RefMap.json"));
|
||||||
|
|
||||||
|
|
|
@ -28,18 +28,13 @@ import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.tinyremapper.OutputConsumerJar;
|
import net.fabricmc.tinyremapper.OutputConsumerJar;
|
||||||
import net.fabricmc.tinyremapper.TinyRemapper;
|
import net.fabricmc.tinyremapper.TinyRemapper;
|
||||||
import net.fabricmc.tinyremapper.TinyUtils;
|
import net.fabricmc.tinyremapper.TinyUtils;
|
||||||
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.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
|
||||||
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;
|
||||||
import java.util.zip.GZIPInputStream;
|
|
||||||
|
|
||||||
public class ModRemapper {
|
public class ModRemapper {
|
||||||
|
|
||||||
|
@ -53,21 +48,6 @@ public class ModRemapper {
|
||||||
project.getLogger().error("Could not find mod jar @" + modJar.getAbsolutePath());
|
project.getLogger().error("Could not find mod jar @" + modJar.getAbsolutePath());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Constants.MAPPINGS_TINY.get(extension).exists()) {
|
|
||||||
if (!Constants.MAPPINGS_TINY_GZ.get(extension).exists()) {
|
|
||||||
project.getLogger().lifecycle(":downloading tiny mappings");
|
|
||||||
FileUtils.copyURLToFile(new URL("http://asie.pl:8080/job/pomf/" + extension.pomfVersion + "/artifact/build/libs/pomf-tiny-" + extension.version + "." + extension.pomfVersion + ".gz"), Constants.MAPPINGS_TINY_GZ.get(extension));
|
|
||||||
}
|
|
||||||
GZIPInputStream gzipInputStream = new GZIPInputStream(new FileInputStream(Constants.MAPPINGS_TINY_GZ.get(extension)));
|
|
||||||
FileOutputStream fileOutputStream = new FileOutputStream(Constants.MAPPINGS_TINY.get(extension));
|
|
||||||
int length;
|
|
||||||
byte[] buffer = new byte[1024];
|
|
||||||
while ((length = gzipInputStream.read(buffer)) > 0) {
|
|
||||||
fileOutputStream.write(buffer, 0, length);
|
|
||||||
}
|
|
||||||
gzipInputStream.close();
|
|
||||||
fileOutputStream.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
Path mappings = Constants.MAPPINGS_TINY.get(extension).toPath();
|
Path mappings = Constants.MAPPINGS_TINY.get(extension).toPath();
|
||||||
|
|
||||||
|
@ -78,7 +58,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_FINAL_JAR.get(extension).getAbsolutePath()));//Seems to fix it not finding it
|
classpathFiles.add(new File(Constants.MINECRAFT_MERGED_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++) {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
package net.fabricmc.loom.util.proccessing;
|
package net.fabricmc.loom.util.proccessing;
|
||||||
|
|
||||||
import net.fabricmc.base.util.MixinPrebaker;
|
import net.fabricmc.base.util.mixin.MixinPrebaker;
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.loom.task.ProcessModsTask;
|
import net.fabricmc.loom.task.ProcessModsTask;
|
||||||
import net.fabricmc.loom.util.Constants;
|
import net.fabricmc.loom.util.Constants;
|
||||||
|
|
Loading…
Reference in New Issue