From f32359d7c363805c61c1e5850dac76b8c0caecac Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Wed, 31 Oct 2018 19:55:29 +0000 Subject: [PATCH] Fix building mods --- src/main/java/net/fabricmc/loom/AbstractPlugin.java | 3 --- src/main/java/net/fabricmc/loom/task/FinaliseJar.java | 6 +++--- src/main/java/net/fabricmc/loom/task/SetupTask.java | 2 +- src/main/java/net/fabricmc/loom/util/Constants.java | 1 - src/main/java/net/fabricmc/loom/util/ModRemapper.java | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/fabricmc/loom/AbstractPlugin.java b/src/main/java/net/fabricmc/loom/AbstractPlugin.java index e15e4e6..dfa9793 100644 --- a/src/main/java/net/fabricmc/loom/AbstractPlugin.java +++ b/src/main/java/net/fabricmc/loom/AbstractPlugin.java @@ -79,7 +79,6 @@ public class AbstractPlugin implements Plugin { project.getConfigurations().maybeCreate(Constants.CONFIG_MC_DEPENDENCIES_CLIENT); project.getConfigurations().maybeCreate(Constants.CONFIG_NATIVES); Configuration compileModsConfig = project.getConfigurations().maybeCreate(Constants.COMPILE_MODS); - project.getConfigurations().maybeCreate(Constants.COMPILE_MODS_PROCESSED); compileModsConfig.setTransitive(false); //Dont get transitive deps of mods @@ -172,12 +171,10 @@ public class AbstractPlugin implements Plugin { ideaModule.getModule().setDownloadSources(true); ideaModule.getModule().setInheritOutputDirs(true); ideaModule.getModule().getScopes().get("COMPILE").get("plus").add(project.getConfigurations().getByName(Constants.CONFIG_MINECRAFT)); - ideaModule.getModule().getScopes().get("COMPILE").get("plus").add(project.getConfigurations().getByName(Constants.COMPILE_MODS_PROCESSED)); // ECLIPSE EclipseModel eclipseModule = (EclipseModel) project.getExtensions().getByName("eclipse"); eclipseModule.getClasspath().getPlusConfigurations().add(project.getConfigurations().getByName(Constants.CONFIG_MINECRAFT)); - eclipseModule.getClasspath().getPlusConfigurations().add(project.getConfigurations().getByName(Constants.COMPILE_MODS_PROCESSED)); } /** diff --git a/src/main/java/net/fabricmc/loom/task/FinaliseJar.java b/src/main/java/net/fabricmc/loom/task/FinaliseJar.java index f11667a..9a93402 100644 --- a/src/main/java/net/fabricmc/loom/task/FinaliseJar.java +++ b/src/main/java/net/fabricmc/loom/task/FinaliseJar.java @@ -36,11 +36,11 @@ public class FinaliseJar extends DefaultTask { @TaskAction public void finaliseJar() throws IOException { + //What is the point to this? LoomGradleExtension extension = this.getProject().getExtensions().getByType(LoomGradleExtension.class); - if(Constants.MINECRAFT_FINAL_JAR.get(extension).exists()){ - Constants.MINECRAFT_FINAL_JAR.get(extension).delete(); + if(!Constants.MINECRAFT_FINAL_JAR.get(extension).exists()){ + FileUtils.copyFile(Constants.MINECRAFT_MAPPED_JAR.get(extension), Constants.MINECRAFT_FINAL_JAR.get(extension)); } - FileUtils.copyFile(Constants.MINECRAFT_MAPPED_JAR.get(extension), Constants.MINECRAFT_FINAL_JAR.get(extension)); } diff --git a/src/main/java/net/fabricmc/loom/task/SetupTask.java b/src/main/java/net/fabricmc/loom/task/SetupTask.java index 647be5b..ffef95f 100644 --- a/src/main/java/net/fabricmc/loom/task/SetupTask.java +++ b/src/main/java/net/fabricmc/loom/task/SetupTask.java @@ -54,7 +54,7 @@ public class SetupTask extends DefaultTask { } ModProccessor.handleMod(input, output, getProject()); Validate.isTrue(output.exists()); - getProject().getDependencies().add(Constants.COMPILE_MODS_PROCESSED, getProject().files(output.getPath())); + getProject().getDependencies().add(Constants.CONFIG_MINECRAFT, getProject().files(output.getPath())); }); } } diff --git a/src/main/java/net/fabricmc/loom/util/Constants.java b/src/main/java/net/fabricmc/loom/util/Constants.java index 120b40b..591b97b 100644 --- a/src/main/java/net/fabricmc/loom/util/Constants.java +++ b/src/main/java/net/fabricmc/loom/util/Constants.java @@ -82,7 +82,6 @@ public class Constants { public static final String CONFIG_MC_DEPENDENCIES_CLIENT = "MC_DEPENDENCIES_CLIENT"; public static final String SYSTEM_ARCH = System.getProperty("os.arch").equals("64") ? "64" : "32"; public static final String COMPILE_MODS = "modCompile"; - public static final String COMPILE_MODS_PROCESSED = "modCompile_PROCESSED"; public static List getClassPath() { URL[] urls = ((URLClassLoader) Constants.class.getClassLoader()).getURLs(); diff --git a/src/main/java/net/fabricmc/loom/util/ModRemapper.java b/src/main/java/net/fabricmc/loom/util/ModRemapper.java index e6a3d15..241aa7f 100644 --- a/src/main/java/net/fabricmc/loom/util/ModRemapper.java +++ b/src/main/java/net/fabricmc/loom/util/ModRemapper.java @@ -96,8 +96,7 @@ public class ModRemapper { throw new RuntimeException("Failed to rebof jar"); } - //Add the deobf jar to be uploaded to maven - project.getArtifacts().add("archives", deobfJar); + deobfJar.delete(); } }