diff --git a/src/main/java/net/fabricmc/loom/util/NestedJars.java b/src/main/java/net/fabricmc/loom/util/NestedJars.java index 3ca54fa..7c0858b 100644 --- a/src/main/java/net/fabricmc/loom/util/NestedJars.java +++ b/src/main/java/net/fabricmc/loom/util/NestedJars.java @@ -29,6 +29,7 @@ import java.io.IOException; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collection; +import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; @@ -99,14 +100,20 @@ public class NestedJars { private static List getContainedJars(Project project) { List fileList = new ArrayList<>(); - ResolvedConfiguration configuration = project.getConfigurations().getByName(Constants.INCLUDE).getResolvedConfiguration(); - Set dependencies = configuration.getFirstLevelModuleDependencies(); + Configuration configuration = project.getConfigurations().getByName(Constants.INCLUDE); + ResolvedConfiguration resolvedConfiguration = configuration.getResolvedConfiguration(); + Set dependencies = resolvedConfiguration.getFirstLevelModuleDependencies(); - for (ResolvedDependency dependency : dependencies) { + // Bit ugly doing this, id guess there is a better way but this works. + Set projectDeps = new HashSet<>(); + + for (Dependency dependency : configuration.getDependencies()) { if (dependency instanceof ProjectDependency) { ProjectDependency projectDependency = (ProjectDependency) dependency; Project dependencyProject = projectDependency.getDependencyProject(); + projectDeps.add(dependency.getGroup() + ":" + dependency.getName() + ":" + dependency.getVersion()); + // TODO change this to allow just normal jar tasks, so a project can have a none loom sub project Collection remapJarTasks = dependencyProject.getTasksByName("remapJar", false); Collection jarTasks = dependencyProject.getTasksByName("jar", false); @@ -118,6 +125,12 @@ public class NestedJars { fileList.add(((AbstractArchiveTask) task).getArchivePath()); } } + } + } + + for (ResolvedDependency dependency : dependencies) { + if (projectDeps.contains(dependency.getModuleGroup() + ":" + dependency.getModuleName() + ":" + dependency.getModuleVersion())) { + continue; } else { fileList.addAll(prepareForNesting( dependency