diff --git a/src/main/java/net/fabricmc/loom/AbstractPlugin.java b/src/main/java/net/fabricmc/loom/AbstractPlugin.java index a5a0237..c77a21e 100644 --- a/src/main/java/net/fabricmc/loom/AbstractPlugin.java +++ b/src/main/java/net/fabricmc/loom/AbstractPlugin.java @@ -69,7 +69,6 @@ public class AbstractPlugin implements Plugin { // Force add Mojang repository addMavenRepo(target, "Mojang", "https://libraries.minecraft.net/"); - Configuration compileModsConfig = project.getConfigurations().maybeCreate(Constants.COMPILE_MODS); compileModsConfig.setTransitive(false); // Dont get transitive deps of mods Configuration minecraftConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT); @@ -89,9 +88,6 @@ public class AbstractPlugin implements Plugin { javaCompileTask.doFirst(task1 -> { project.getLogger().lifecycle(":setting java compiler args"); try { - //javaCompileTask.getClasspath().add(target.files(this.getClass().getProtectionDomain().getCodeSource().getLocation())); - - javaCompileTask.getOptions().getCompilerArgs().add("-AinMapFileNamedIntermediary=" + extension.getMinecraftProvider().pomfProvider.MAPPINGS_TINY.getCanonicalPath()); javaCompileTask.getOptions().getCompilerArgs().add("-AoutMapFileNamedIntermediary=" + extension.getMinecraftProvider().pomfProvider.MAPPINGS_MIXIN_EXPORT.getCanonicalPath()); if(extension.refmapName == null || extension.refmapName.isEmpty()){ diff --git a/src/main/java/net/fabricmc/loom/providers/MinecraftJarProvider.java b/src/main/java/net/fabricmc/loom/providers/MinecraftJarProvider.java index 971fe95..6e08680 100644 --- a/src/main/java/net/fabricmc/loom/providers/MinecraftJarProvider.java +++ b/src/main/java/net/fabricmc/loom/providers/MinecraftJarProvider.java @@ -46,10 +46,10 @@ public class MinecraftJarProvider { public MinecraftJarProvider(Project project, MinecraftProvider minecraftProvider) throws IOException { this.minecraftProvider = minecraftProvider; initFiles(project, minecraftProvider); - proccess(project, minecraftProvider); + process(project, minecraftProvider); } - private void proccess(Project project, MinecraftProvider minecraftProvider) throws IOException { + private void process(Project project, MinecraftProvider minecraftProvider) throws IOException { if (!MINECRAFT_MERGED_JAR.exists()) { mergeJars(project); } @@ -67,7 +67,7 @@ public class MinecraftJarProvider { if (!MINECRAFT_MAPPED_JAR.exists()) { throw new RuntimeException("mapped jar not found"); } - minecraftProvider.addDep(MINECRAFT_MAPPED_JAR, project); + minecraftProvider.addDependency(MINECRAFT_MAPPED_JAR, project); } public void mergeJars(Project project) throws IOException { diff --git a/src/main/java/net/fabricmc/loom/providers/MinecraftLibraryProvider.java b/src/main/java/net/fabricmc/loom/providers/MinecraftLibraryProvider.java index 6dc6535..08f0465 100644 --- a/src/main/java/net/fabricmc/loom/providers/MinecraftLibraryProvider.java +++ b/src/main/java/net/fabricmc/loom/providers/MinecraftLibraryProvider.java @@ -24,8 +24,6 @@ package net.fabricmc.loom.providers; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; import com.google.gson.Gson; import net.fabricmc.loom.LoomGradleExtension; import net.fabricmc.loom.util.Checksum; @@ -44,7 +42,6 @@ import java.net.URL; import java.util.Collection; import java.util.HashSet; import java.util.Map; -import java.util.Objects; public class MinecraftLibraryProvider { @@ -71,7 +68,7 @@ public class MinecraftLibraryProvider { FileUtils.copyURLToFile(new URL(library.getURL()), library.getFile(MINECRAFT_LIBS)); } libs.add(library.getFile(MINECRAFT_LIBS)); - minecraftProvider.addDep(library.getFile(MINECRAFT_LIBS), project); + minecraftProvider.addDependency(library.getFile(MINECRAFT_LIBS), project); } } diff --git a/src/main/java/net/fabricmc/loom/providers/MinecraftProvider.java b/src/main/java/net/fabricmc/loom/providers/MinecraftProvider.java index b5ff0b7..f24dbc3 100644 --- a/src/main/java/net/fabricmc/loom/providers/MinecraftProvider.java +++ b/src/main/java/net/fabricmc/loom/providers/MinecraftProvider.java @@ -57,7 +57,7 @@ public class MinecraftProvider extends DependencyProvider { Gson gson = new Gson(); @Override - public void provide(DependcyInfo dependency, Project project, LoomGradleExtension extension) throws Exception { + public void provide(DependencyInfo dependency, Project project, LoomGradleExtension extension) throws Exception { minecraftVersion = dependency.getDependency().getName(); pomfVersion = dependency.getDependency().getVersion(); @@ -66,12 +66,14 @@ public class MinecraftProvider extends DependencyProvider { downloadMcJson(); versionInfo = gson.fromJson(new FileReader(MINECRAFT_JSON), MinecraftVersionInfo.class); + // Add Loom as an annotation processor + addDependency(project.files(this.getClass().getProtectionDomain().getCodeSource().getLocation()), project, "compileOnly"); + downloadJars(); libraryProvider = new MinecraftLibraryProvider(); libraryProvider.provide(this, project); - //Downloads and setups up pomf pomfProvider = new PomfProvider(pomfVersion, minecraftVersion, project); jarProvider = new MinecraftJarProvider(project, this); diff --git a/src/main/java/net/fabricmc/loom/providers/ModRemapperProvider.java b/src/main/java/net/fabricmc/loom/providers/ModRemapperProvider.java index 296818d..9d712a2 100644 --- a/src/main/java/net/fabricmc/loom/providers/ModRemapperProvider.java +++ b/src/main/java/net/fabricmc/loom/providers/ModRemapperProvider.java @@ -34,7 +34,7 @@ import java.io.File; public class ModRemapperProvider extends DependencyProvider { @Override - public void provide(DependcyInfo dependency, Project project, LoomGradleExtension extension) { + public void provide(DependencyInfo dependency, Project project, LoomGradleExtension extension) { File input = dependency.resolveFile(); project.getLogger().lifecycle("Providing " + dependency.getDepString()); @@ -46,7 +46,7 @@ public class ModRemapperProvider extends DependencyProvider { ModProcessor.handleMod(input, output, project); - addDep(output, project); + addDependency(output, project); } @Override diff --git a/src/main/java/net/fabricmc/loom/util/DependencyProvider.java b/src/main/java/net/fabricmc/loom/util/DependencyProvider.java index 56e03e2..1a2ce73 100644 --- a/src/main/java/net/fabricmc/loom/util/DependencyProvider.java +++ b/src/main/java/net/fabricmc/loom/util/DependencyProvider.java @@ -36,15 +36,19 @@ public abstract class DependencyProvider { private LoomDependencyManager dependencyManager; - public abstract void provide(DependcyInfo dependency, Project project, LoomGradleExtension extension) throws Exception; + public abstract void provide(DependencyInfo dependency, Project project, LoomGradleExtension extension) throws Exception; public abstract String getTargetConfig(); - public void addDep(Object object, Project project){ + public void addDependency(Object object, Project project) { + addDependency(object, project, "compile"); + } + + public void addDependency(Object object, Project project, String target) { if(object instanceof File){ object = project.files(object); } - project.getDependencies().add("compile", object); + project.getDependencies().add(target, object); } public void register(LoomDependencyManager dependencyManager){ @@ -55,11 +59,11 @@ public abstract class DependencyProvider { return dependencyManager; } - public static class DependcyInfo { + public static class DependencyInfo { final Dependency dependency; final Configuration sourceConfiguration; - public DependcyInfo(Dependency dependency, Configuration sourceConfiguration) { + public DependencyInfo(Dependency dependency, Configuration sourceConfiguration) { this.dependency = dependency; this.sourceConfiguration = sourceConfiguration; } diff --git a/src/main/java/net/fabricmc/loom/util/LoomDependencyManager.java b/src/main/java/net/fabricmc/loom/util/LoomDependencyManager.java index 132863c..0dcddb4 100644 --- a/src/main/java/net/fabricmc/loom/util/LoomDependencyManager.java +++ b/src/main/java/net/fabricmc/loom/util/LoomDependencyManager.java @@ -69,7 +69,7 @@ public class LoomDependencyManager { configuration.getDependencies().stream().forEach(dependency -> { for(DependencyProvider provider : dependencyProviderList){ if(provider.getTargetConfig().equals(config)){ - DependencyProvider.DependcyInfo info = new DependencyProvider.DependcyInfo(dependency, configuration); + DependencyProvider.DependencyInfo info = new DependencyProvider.DependencyInfo(dependency, configuration); try { provider.provide(info, project, extension); } catch (Exception e) {