From c2d61875e1a0da42de32b9e86c08b245774583d7 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Fri, 13 Dec 2019 18:24:01 +0000 Subject: [PATCH] Yet another attempt to fix the annotation processor issue. --- src/main/java/net/fabricmc/loom/AbstractPlugin.java | 2 +- src/main/java/net/fabricmc/loom/LoomGradleExtension.java | 4 ++++ .../java/net/fabricmc/loom/util/LoomDependencyManager.java | 7 ++++++- .../net/fabricmc/loom/util/SetupIntelijRunConfigs.java | 7 ++++--- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/fabricmc/loom/AbstractPlugin.java b/src/main/java/net/fabricmc/loom/AbstractPlugin.java index 84e09ab..68e7cf8 100644 --- a/src/main/java/net/fabricmc/loom/AbstractPlugin.java +++ b/src/main/java/net/fabricmc/loom/AbstractPlugin.java @@ -241,7 +241,7 @@ public class AbstractPlugin implements Plugin { Javadoc javadoc = (Javadoc) project.getTasks().getByName(JavaPlugin.JAVADOC_TASK_NAME); javadoc.setClasspath(main.getOutput().plus(main.getCompileClasspath())); - if (!Boolean.parseBoolean(System.getProperty("idea.sync.active", "false"))) { + if (!project.getExtensions().getByType(LoomGradleExtension.class).ideSync()) { // Add Mixin dependencies project.getDependencies().add(JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME, "net.fabricmc:fabric-mixin-compile-extensions:" + Constants.MIXIN_COMPILE_EXTENSIONS_VERSION); } diff --git a/src/main/java/net/fabricmc/loom/LoomGradleExtension.java b/src/main/java/net/fabricmc/loom/LoomGradleExtension.java index 959f573..7a05416 100644 --- a/src/main/java/net/fabricmc/loom/LoomGradleExtension.java +++ b/src/main/java/net/fabricmc/loom/LoomGradleExtension.java @@ -290,4 +290,8 @@ public class LoomGradleExtension { return refmapName; } + + public boolean ideSync() { + return Boolean.parseBoolean(System.getProperty("idea.sync.active", "false")); + } } diff --git a/src/main/java/net/fabricmc/loom/util/LoomDependencyManager.java b/src/main/java/net/fabricmc/loom/util/LoomDependencyManager.java index fce9a26..35349df 100644 --- a/src/main/java/net/fabricmc/loom/util/LoomDependencyManager.java +++ b/src/main/java/net/fabricmc/loom/util/LoomDependencyManager.java @@ -156,6 +156,8 @@ public class LoomDependencyManager { } private static void handleInstallerJson(JsonObject jsonObject, Project project) { + LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); + JsonObject libraries = jsonObject.get("libraries").getAsJsonObject(); Configuration mcDepsConfig = project.getConfigurations().getByName(Constants.MINECRAFT_DEPENDENCIES); Configuration apDepsConfig = project.getConfigurations().getByName("annotationProcessor"); @@ -166,7 +168,10 @@ public class LoomDependencyManager { ExternalModuleDependency modDep = (ExternalModuleDependency) project.getDependencies().create(name); modDep.setTransitive(false); mcDepsConfig.getDependencies().add(modDep); - apDepsConfig.getDependencies().add(modDep); + + if (!extension.ideSync()) { + apDepsConfig.getDependencies().add(modDep); + } project.getLogger().debug("Loom adding " + name + " from installer JSON"); diff --git a/src/main/java/net/fabricmc/loom/util/SetupIntelijRunConfigs.java b/src/main/java/net/fabricmc/loom/util/SetupIntelijRunConfigs.java index 018eb0c..5066746 100644 --- a/src/main/java/net/fabricmc/loom/util/SetupIntelijRunConfigs.java +++ b/src/main/java/net/fabricmc/loom/util/SetupIntelijRunConfigs.java @@ -59,9 +59,10 @@ public class SetupIntelijRunConfigs { } private static void generate(Project project) throws IOException { - //Ensures the assets are downloaded when idea is syncing a project - if (Boolean.parseBoolean(System.getProperty("idea.sync.active", "false"))) { - LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); + LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); + + if (extension.ideSync()) { + //Ensures the assets are downloaded when idea is syncing a project MinecraftAssetsProvider.provide(extension.getMinecraftProvider(), project); MinecraftNativesProvider.provide(extension.getMinecraftProvider(), project); }