Skip to content

Commit a67180d

Browse files
authored
Track enabled test task candidate class files as task input (elastic#47054)
1 parent 76de93c commit a67180d

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

buildSrc/src/main/java/org/elasticsearch/gradle/precommit/TestingConventionsTasks.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,13 @@ public TestingConventionsTasks() {
7070
}
7171

7272
@Input
73-
public Map<String, Set<File>> classFilesPerEnabledTask(FileTree testClassFiles) {
74-
Map<String, Set<File>> collector = new HashMap<>();
75-
76-
// Gradle Test
77-
collector.putAll(
78-
getProject().getTasks().withType(Test.class).stream()
79-
.filter(Task::getEnabled)
80-
.collect(Collectors.toMap(
81-
Task::getPath,
82-
task -> task.getCandidateClassFiles().getFiles()
83-
))
84-
);
85-
return Collections.unmodifiableMap(collector);
73+
public Map<String, Set<File>> getClassFilesPerEnabledTask() {
74+
return getProject().getTasks().withType(Test.class).stream()
75+
.filter(Task::getEnabled)
76+
.collect(Collectors.toMap(
77+
Task::getPath,
78+
task -> task.getCandidateClassFiles().getFiles()
79+
));
8680
}
8781

8882
@Input
@@ -154,7 +148,7 @@ public void doCheck() throws IOException {
154148
.collect(Collectors.toList())
155149
).getAsFileTree();
156150

157-
final Map<String, Set<File>> classFilesPerTask = classFilesPerEnabledTask(allTestClassFiles);
151+
final Map<String, Set<File>> classFilesPerTask = getClassFilesPerEnabledTask();
158152

159153
final Map<String, Set<Class<?>>> testClassesPerTask = classFilesPerTask.entrySet().stream()
160154
.collect(

0 commit comments

Comments
 (0)