Skip to content

Commit

Permalink
Prevent IDEs from creating runs when it is a unit test run.
Browse files Browse the repository at this point in the history
  • Loading branch information
marchermans committed May 19, 2024
1 parent 85759a8 commit 774c46a
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ public void idea(Project project, IdeaModel idea, ProjectSettings ideaExtension)
final String runName = StringUtils.capitalize(project.getName() + ": " + StringUtils.capitalize(nameWithoutSpaces));

final RunImpl runImpl = (RunImpl) run;

//Do not generate a run configuration for unit tests
if (runImpl.getIsUnitTest().get())
return;

final IdeaRunExtension runIdeaConfig = run.getExtensions().getByType(IdeaRunExtension.class);
final TaskProvider<?> ideBeforeRunTask = createIdeBeforeRunTask(project, nameWithoutSpaces, run, runImpl);

Expand Down Expand Up @@ -164,6 +169,11 @@ public void eclipse(Project project, EclipseModel eclipse) {
final String runName = StringUtils.capitalize(project.getName() + " - " + StringUtils.capitalize(name.replace(" ", "-")));

final RunImpl runImpl = (RunImpl) run;

//Do not generate a run configuration for unit tests
if (runImpl.getIsUnitTest().get())
return;

final TaskProvider<?> ideBeforeRunTask = createIdeBeforeRunTask(project, name, run, runImpl);
final List<TaskProvider<?>> copyProcessResourcesTasks = createEclipseCopyResourcesTasks(eclipse, run);
ideBeforeRunTask.configure(task -> copyProcessResourcesTasks.forEach(t -> task.dependsOn(t)));
Expand Down

0 comments on commit 774c46a

Please sign in to comment.