apply nested JAR dependencies to every remapJar task which nests

This commit is contained in:
Adrian Siekierka
2019-04-22 01:25:03 +02:00
parent 7c25b0399c
commit 3094d70731
2 changed files with 13 additions and 4 deletions

View File

@@ -267,8 +267,17 @@ public class AbstractPlugin implements Plugin<Project> {
remapJarTask.doLast(task -> project1.getArtifacts().add("archives", remapJarTask.jar));
remapJarTask.dependsOn(project1.getTasks().getByName("jar"));
project1.getTasks().getByName("build").dependsOn(remapJarTask);
//Run all the sub project remap jars tasks before the root projects jar, this is to allow us to include projects
NestedJars.getRequiredTasks(project1).forEach(remapJarTask::dependsOn);
Map<Project, Set<Task>> taskMap = project.getAllTasks(true);
for (Map.Entry<Project, Set<Task>> entry : taskMap.entrySet()) {
Set<Task> taskSet = entry.getValue();
for (Task task : taskSet) {
if (task instanceof RemapJar && ((RemapJar) task).isNestJar()) {
//Run all the sub project remap jars tasks before the root projects jar, this is to allow us to include projects
NestedJars.getRequiredTasks(project1).forEach(task::dependsOn);
}
}
}
try {
AbstractArchiveTask sourcesTask = (AbstractArchiveTask) project1.getTasks().getByName("sourcesJar");