Skip to content

Commit

Permalink
Fix creation of eclipse process resources task (#116)
Browse files Browse the repository at this point in the history
* Update IdeRunIntegrationManager.java

* ..
  • Loading branch information
Nightenom authored Feb 8, 2024
1 parent 98c5ca6 commit 62f5d5d
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<TaskProvider<?>> copyProcessResourcesTasks = createEclipseCopyResourcesTasks(eclipse, run);
ideBeforeRunTask.configure(task -> copyProcessResourcesTasks.forEach(t -> task.dependsOn(t)));

try {
final GradleLaunchConfig idePreRunTask = GradleLaunchConfig.builder(eclipse.getProject().getName())
Expand Down Expand Up @@ -214,8 +216,9 @@ private TaskProvider<?> createIdeBeforeRunTask(Project project, String name, Run

return ideBeforeRunTask;
}

private void addEclipseCopyResourcesTasks(EclipseModel eclipse, Run run, Consumer<TaskProvider<?>> tasksConsumer) {

private List<TaskProvider<?>> createEclipseCopyResourcesTasks(EclipseModel eclipse, Run run) {
final List<TaskProvider<?>> copyProcessResources = new ArrayList<>();
for (SourceSet sourceSet : run.getModSources().get()) {
final Project sourceSetProject = SourceSetUtils.getProject(sourceSet);

Expand All @@ -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) {
Expand Down

0 comments on commit 62f5d5d

Please sign in to comment.