fix mod compilation
parent
e05aae6cd8
commit
6b17d207d5
|
@ -105,6 +105,7 @@ public class AbstractPlugin implements Plugin<Project> {
|
||||||
javaCompileTask.doFirst(task1 -> {
|
javaCompileTask.doFirst(task1 -> {
|
||||||
project.getLogger().lifecycle(":setting java compiler args");
|
project.getLogger().lifecycle(":setting java compiler args");
|
||||||
try {
|
try {
|
||||||
|
javaCompileTask.getClasspath().add(project.getConfigurations().getByName(Constants.CONFIG_MINECRAFT));
|
||||||
javaCompileTask.getClasspath().add(target.files(this.getClass().getProtectionDomain().getCodeSource().getLocation()));
|
javaCompileTask.getClasspath().add(target.files(this.getClass().getProtectionDomain().getCodeSource().getLocation()));
|
||||||
|
|
||||||
javaCompileTask.getOptions().getCompilerArgs().add("-AinMapFilePomfIntermediary=" + Constants.MAPPINGS_TINY.get(extension).getCanonicalPath());
|
javaCompileTask.getOptions().getCompilerArgs().add("-AinMapFilePomfIntermediary=" + Constants.MAPPINGS_TINY.get(extension).getCanonicalPath());
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class SetupTask extends DefaultTask {
|
||||||
public void configureModRemapper(){
|
public void configureModRemapper(){
|
||||||
LoomGradleExtension extension = getProject().getExtensions().getByType(LoomGradleExtension.class);
|
LoomGradleExtension extension = getProject().getExtensions().getByType(LoomGradleExtension.class);
|
||||||
Configuration inputConfig = getProject().getConfigurations().getByName(Constants.COMPILE_MODS);
|
Configuration inputConfig = getProject().getConfigurations().getByName(Constants.COMPILE_MODS);
|
||||||
|
|
||||||
inputConfig.getResolvedConfiguration().getFiles().stream()
|
inputConfig.getResolvedConfiguration().getFiles().stream()
|
||||||
.filter(file -> file.getName().endsWith(".jar"))
|
.filter(file -> file.getName().endsWith(".jar"))
|
||||||
.forEach(input -> {
|
.forEach(input -> {
|
||||||
|
|
|
@ -65,7 +65,6 @@ public class Constants {
|
||||||
public static final IDelayed<File> MINECRAFT_LIBS = new DelayedFile(extension -> new File(extension.getUserCache(), extension.version + "-libs"));
|
public static final IDelayed<File> MINECRAFT_LIBS = new DelayedFile(extension -> new File(extension.getUserCache(), extension.version + "-libs"));
|
||||||
public static final IDelayed<File> MINECRAFT_NATIVES = new DelayedFile(extension -> new File(extension.getUserCache(), extension.version + "-natives"));
|
public static final IDelayed<File> MINECRAFT_NATIVES = new DelayedFile(extension -> new File(extension.getUserCache(), extension.version + "-natives"));
|
||||||
public static final IDelayed<File> MINECRAFT_JSON = new DelayedFile(extension -> new File(extension.getUserCache(), extension.version + "-info.json"));
|
public static final IDelayed<File> MINECRAFT_JSON = new DelayedFile(extension -> new File(extension.getUserCache(), extension.version + "-info.json"));
|
||||||
public static final IDelayed<File> REF_MAP = new DelayedFile(extension -> new File(CACHE_FILES, "mixin-refmap.json"));
|
|
||||||
|
|
||||||
public static final IDelayed<File> VERSION_MANIFEST = new DelayedFile(extension -> new File(extension.getUserCache(), "version_manifest.json"));
|
public static final IDelayed<File> VERSION_MANIFEST = new DelayedFile(extension -> new File(extension.getUserCache(), "version_manifest.json"));
|
||||||
|
|
||||||
|
|
|
@ -53,10 +53,7 @@ import java.lang.reflect.Field;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
@ -83,7 +80,11 @@ public class ModProcessor {
|
||||||
File mappingsFile = Constants.MAPPINGS_TINY.get(extension);
|
File mappingsFile = Constants.MAPPINGS_TINY.get(extension);
|
||||||
Path mappings = mappingsFile.toPath();
|
Path mappings = mappingsFile.toPath();
|
||||||
Path mc = Constants.MINECRAFT_INTERMEDIARY_JAR.get(extension).toPath();
|
Path mc = Constants.MINECRAFT_INTERMEDIARY_JAR.get(extension).toPath();
|
||||||
Path[] classpath = project.getConfigurations().getByName(Constants.CONFIG_MC_DEPENDENCIES).getFiles().stream()
|
Path[] mcDeps = project.getConfigurations().getByName(Constants.CONFIG_MC_DEPENDENCIES).getFiles().stream()
|
||||||
|
.map(File::toPath)
|
||||||
|
.toArray(Path[]::new);
|
||||||
|
Collection<File> modCompileFiles = project.getConfigurations().getByName(Constants.COMPILE_MODS).getFiles();
|
||||||
|
Path[] modCompiles = modCompileFiles.stream()
|
||||||
.map(File::toPath)
|
.map(File::toPath)
|
||||||
.toArray(Path[]::new);
|
.toArray(Path[]::new);
|
||||||
|
|
||||||
|
@ -96,9 +97,12 @@ public class ModProcessor {
|
||||||
try {
|
try {
|
||||||
OutputConsumerPath outputConsumer = new OutputConsumerPath(Paths.get(output.getAbsolutePath()));
|
OutputConsumerPath outputConsumer = new OutputConsumerPath(Paths.get(output.getAbsolutePath()));
|
||||||
outputConsumer.addNonClassFiles(input.toPath());
|
outputConsumer.addNonClassFiles(input.toPath());
|
||||||
|
if (!modCompileFiles.contains(input)) {
|
||||||
remapper.read(input.toPath());
|
remapper.read(input.toPath());
|
||||||
|
}
|
||||||
|
remapper.read(modCompiles);
|
||||||
remapper.read(mc);
|
remapper.read(mc);
|
||||||
remapper.read(classpath);
|
remapper.read(mcDeps);
|
||||||
remapper.apply(input.toPath(), outputConsumer);
|
remapper.apply(input.toPath(), outputConsumer);
|
||||||
outputConsumer.finish();
|
outputConsumer.finish();
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
|
@ -110,7 +114,6 @@ public class ModProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
project.getLogger().lifecycle(":remapping " + input.getName() + " (Mixin reference map)");
|
|
||||||
// first, identify all of the mixin refmaps
|
// first, identify all of the mixin refmaps
|
||||||
Set<String> mixinRefmapFilenames = new HashSet<>();
|
Set<String> mixinRefmapFilenames = new HashSet<>();
|
||||||
// TODO: this is a lovely hack
|
// TODO: this is a lovely hack
|
||||||
|
@ -139,6 +142,8 @@ public class ModProcessor {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
project.getLogger().lifecycle(":remapping " + input.getName() + " (Mixin reference maps)");
|
||||||
|
|
||||||
ZipUtil.transformEntries(
|
ZipUtil.transformEntries(
|
||||||
output,
|
output,
|
||||||
mixinRefmapFilenames.stream()
|
mixinRefmapFilenames.stream()
|
||||||
|
|
Loading…
Reference in New Issue