Skip to content

Commit

Permalink
Track enabled test task candidate class files as task input (#47054)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-vieira committed Sep 25, 2019
1 parent a46eef9 commit d0495b8
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,13 @@ public TestingConventionsTasks() {
}

@Input
public Map<String, Set<File>> classFilesPerEnabledTask(FileTree testClassFiles) {
Map<String, Set<File>> 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<String, Set<File>> getClassFilesPerEnabledTask() {
return getProject().getTasks().withType(Test.class).stream()
.filter(Task::getEnabled)
.collect(Collectors.toMap(
Task::getPath,
task -> task.getCandidateClassFiles().getFiles()
));
}

@Input
Expand Down Expand Up @@ -154,7 +148,7 @@ public void doCheck() throws IOException {
.collect(Collectors.toList())
).getAsFileTree();

final Map<String, Set<File>> classFilesPerTask = classFilesPerEnabledTask(allTestClassFiles);
final Map<String, Set<File>> classFilesPerTask = getClassFilesPerEnabledTask();

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

0 comments on commit d0495b8

Please sign in to comment.