diff --git a/src/main/java/net/fabricmc/loom/AbstractPlugin.java b/src/main/java/net/fabricmc/loom/AbstractPlugin.java index c20ea5f..5764c68 100644 --- a/src/main/java/net/fabricmc/loom/AbstractPlugin.java +++ b/src/main/java/net/fabricmc/loom/AbstractPlugin.java @@ -57,6 +57,10 @@ import java.util.Set; public class AbstractPlugin implements Plugin { protected Project project; + private void extendsFrom(String a, String b) { + project.getConfigurations().getByName(a).extendsFrom(project.getConfigurations().getByName(b)); + } + @Override public void apply(Project target) { this.project = target; @@ -76,14 +80,17 @@ public class AbstractPlugin implements Plugin { Configuration compileModsConfig = project.getConfigurations().maybeCreate(Constants.COMPILE_MODS); compileModsConfig.setTransitive(false); // Dont get transitive deps of mods + Configuration minecraftNamedConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT_NAMED); + minecraftNamedConfig.setTransitive(false); // The launchers do not recurse dependencies + Configuration minecraftIntermediaryConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT_INTERMEDIARY); + minecraftIntermediaryConfig.setTransitive(false); + Configuration minecraftDependenciesConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT_DEPENDENCIES); + minecraftDependenciesConfig.setTransitive(false); Configuration minecraftConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT); - minecraftConfig.setTransitive(false); // The launchers do not recurse dependencies + minecraftConfig.setTransitive(false); project.getConfigurations().maybeCreate(Constants.MAPPINGS); - Configuration minecraftMappedConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT_MAPPED); - minecraftMappedConfig.setTransitive(false); // The launchers do not recurse dependencies - configureIDEs(); configureCompile(); @@ -236,6 +243,13 @@ public class AbstractPlugin implements Plugin { handler.add("annotationProcessor", "net.fabricmc:sponge-mixin:" + extension.getMixinVersion()); handler.add("annotationProcessor", "net.fabricmc:fabric-loom:" + extension.getLoomVersion()); + extendsFrom(Constants.MINECRAFT_NAMED, Constants.MINECRAFT_DEPENDENCIES); + extendsFrom(Constants.COMPILE_MODS, Constants.MINECRAFT_NAMED); + extendsFrom("compile", Constants.COMPILE_MODS); + extendsFrom("compile", Constants.MAPPINGS); + extendsFrom("annotationProcessor", Constants.COMPILE_MODS); + extendsFrom("annotationProcessor", Constants.MAPPINGS); + // Enables the default mod remapper if (extension.remapMod) { AbstractArchiveTask jarTask = (AbstractArchiveTask) project1.getTasks().getByName("jar"); diff --git a/src/main/java/net/fabricmc/loom/providers/MappingsProvider.java b/src/main/java/net/fabricmc/loom/providers/MappingsProvider.java index ec4cf33..37f2f74 100644 --- a/src/main/java/net/fabricmc/loom/providers/MappingsProvider.java +++ b/src/main/java/net/fabricmc/loom/providers/MappingsProvider.java @@ -92,8 +92,6 @@ public class MappingsProvider extends DependencyProvider { }); } - project.getDependencies().add("compile", project.getDependencies().module(dependency.getDependency().getGroup() + ":" + dependency.getDependency().getName() + ":" + version)); - mappedProvider = new MinecraftMappedProvider(); mappedProvider.initFiles(project, minecraftProvider, this); mappedProvider.provide(dependency, project, extension, postPopulationScheduler); diff --git a/src/main/java/net/fabricmc/loom/providers/MinecraftLibraryProvider.java b/src/main/java/net/fabricmc/loom/providers/MinecraftLibraryProvider.java index 54aac9c..56df5f5 100644 --- a/src/main/java/net/fabricmc/loom/providers/MinecraftLibraryProvider.java +++ b/src/main/java/net/fabricmc/loom/providers/MinecraftLibraryProvider.java @@ -66,7 +66,7 @@ public class MinecraftLibraryProvider { isClientOnly = true; } */ - project.getDependencies().add("compile", project.getDependencies().module(library.getArtifactName())); + project.getDependencies().add(Constants.MINECRAFT_DEPENDENCIES, project.getDependencies().module(library.getArtifactName())); } } diff --git a/src/main/java/net/fabricmc/loom/providers/MinecraftMappedProvider.java b/src/main/java/net/fabricmc/loom/providers/MinecraftMappedProvider.java index 082f2d3..52ed300 100644 --- a/src/main/java/net/fabricmc/loom/providers/MinecraftMappedProvider.java +++ b/src/main/java/net/fabricmc/loom/providers/MinecraftMappedProvider.java @@ -65,7 +65,9 @@ public class MinecraftMappedProvider extends DependencyProvider { } String version = minecraftProvider.minecraftVersion + "-mapped-" + extension.getMappingsProvider().mappingsVersion; - project.getDependencies().add("compile", project.getDependencies().module("net.minecraft:minecraft:" + version)); + project.getDependencies().add(Constants.MINECRAFT_NAMED, project.getDependencies().module("net.minecraft:minecraft:" + version)); + version = minecraftProvider.minecraftVersion + "-intermediary"; + project.getDependencies().add(Constants.MINECRAFT_INTERMEDIARY, project.getDependencies().module("net.minecraft:minecraft:" + version)); } public void initFiles(Project project, MinecraftProvider minecraftProvider, MappingsProvider mappingsProvider) { @@ -89,6 +91,6 @@ public class MinecraftMappedProvider extends DependencyProvider { @Override public String getTargetConfig() { - return Constants.MINECRAFT_MAPPED; + return Constants.MINECRAFT_NAMED; } } diff --git a/src/main/java/net/fabricmc/loom/providers/ModRemapperProvider.java b/src/main/java/net/fabricmc/loom/providers/ModRemapperProvider.java index 34c5df2..f322094 100644 --- a/src/main/java/net/fabricmc/loom/providers/ModRemapperProvider.java +++ b/src/main/java/net/fabricmc/loom/providers/ModRemapperProvider.java @@ -62,7 +62,7 @@ public class ModRemapperProvider extends DependencyProvider { throw new RuntimeException("Failed to remap mod"); } - project.getDependencies().add("compile", project.getDependencies().module( + project.getDependencies().add(Constants.COMPILE_MODS, project.getDependencies().module( rds + verSuffix )); diff --git a/src/main/java/net/fabricmc/loom/util/Constants.java b/src/main/java/net/fabricmc/loom/util/Constants.java index f64494b..6edbc3e 100644 --- a/src/main/java/net/fabricmc/loom/util/Constants.java +++ b/src/main/java/net/fabricmc/loom/util/Constants.java @@ -37,6 +37,8 @@ public class Constants { public static final String COMPILE_MODS = "modCompile"; public static final String MINECRAFT = "minecraft"; - public static final String MINECRAFT_MAPPED = "minecraftMapped"; + public static final String MINECRAFT_DEPENDENCIES = "minecraftLibraries"; + public static final String MINECRAFT_INTERMEDIARY = "minecraftIntermediary"; + public static final String MINECRAFT_NAMED = "minecraftNamed"; public static final String MAPPINGS = "mappings"; }