From d0495b8f933195bd16ff621e141449cd20a341f5 Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Wed, 25 Sep 2019 11:19:39 -0700 Subject: [PATCH] Track enabled test task candidate class files as task input (#47054) --- .../precommit/TestingConventionsTasks.java | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/TestingConventionsTasks.java b/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/TestingConventionsTasks.java index 95ad323ceda..2f5028315a4 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/TestingConventionsTasks.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/TestingConventionsTasks.java @@ -70,19 +70,13 @@ public class TestingConventionsTasks extends DefaultTask { } @Input - public Map> classFilesPerEnabledTask(FileTree testClassFiles) { - Map> collector = new HashMap<>(); - - // Gradle Test - collector.putAll( - getProject().getTasks().withType(Test.class).stream() - .filter(Task::getEnabled) - .collect(Collectors.toMap( - Task::getPath, - task -> task.getCandidateClassFiles().getFiles() - )) - ); - return Collections.unmodifiableMap(collector); + public Map> getClassFilesPerEnabledTask() { + return getProject().getTasks().withType(Test.class).stream() + .filter(Task::getEnabled) + .collect(Collectors.toMap( + Task::getPath, + task -> task.getCandidateClassFiles().getFiles() + )); } @Input @@ -154,7 +148,7 @@ public class TestingConventionsTasks extends DefaultTask { .collect(Collectors.toList()) ).getAsFileTree(); - final Map> classFilesPerTask = classFilesPerEnabledTask(allTestClassFiles); + final Map> classFilesPerTask = getClassFilesPerEnabledTask(); final Map>> testClassesPerTask = classFilesPerTask.entrySet().stream() .collect(