From 62f5d5d7cd67f4d9da11850d9bf2675c10f9a22a Mon Sep 17 00:00:00 2001 From: Nightenom <17338378+Nightenom@users.noreply.github.com> Date: Thu, 8 Feb 2024 10:40:08 +0100 Subject: [PATCH] Fix creation of eclipse process resources task (#116) * Update IdeRunIntegrationManager.java * .. --- .../common/runs/ide/IdeRunIntegrationManager.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/net/neoforged/gradle/common/runs/ide/IdeRunIntegrationManager.java b/common/src/main/java/net/neoforged/gradle/common/runs/ide/IdeRunIntegrationManager.java index 9921c45b6..cdfd7fd99 100644 --- a/common/src/main/java/net/neoforged/gradle/common/runs/ide/IdeRunIntegrationManager.java +++ b/common/src/main/java/net/neoforged/gradle/common/runs/ide/IdeRunIntegrationManager.java @@ -37,6 +37,7 @@ import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.Path; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -137,7 +138,8 @@ public void eclipse(Project project, EclipseModel eclipse) { final RunImpl runImpl = (RunImpl) run; final TaskProvider ideBeforeRunTask = createIdeBeforeRunTask(project, name, run, runImpl); - ideBeforeRunTask.configure(task -> addEclipseCopyResourcesTasks(eclipse, run, t -> task.dependsOn(t))); + final List> copyProcessResourcesTasks = createEclipseCopyResourcesTasks(eclipse, run); + ideBeforeRunTask.configure(task -> copyProcessResourcesTasks.forEach(t -> task.dependsOn(t))); try { final GradleLaunchConfig idePreRunTask = GradleLaunchConfig.builder(eclipse.getProject().getName()) @@ -214,8 +216,9 @@ private TaskProvider createIdeBeforeRunTask(Project project, String name, Run return ideBeforeRunTask; } - - private void addEclipseCopyResourcesTasks(EclipseModel eclipse, Run run, Consumer> tasksConsumer) { + + private List> createEclipseCopyResourcesTasks(EclipseModel eclipse, Run run) { + final List> copyProcessResources = new ArrayList<>(); for (SourceSet sourceSet : run.getModSources().get()) { final Project sourceSetProject = SourceSetUtils.getProject(sourceSet); @@ -242,8 +245,9 @@ private void addEclipseCopyResourcesTasks(EclipseModel eclipse, Run run, Consume }); } - tasksConsumer.accept(eclipseResourcesTask); + copyProcessResources.add(eclipseResourcesTask); } + return copyProcessResources; } private static void writeLaunchToFile(Project project, String fileName, LaunchConfig config) {