use of org.gradle.execution.TaskSelectionException in project gradle by gradle.
the class TestExecutionBuildConfigurationAction method queryTestTasks.
private Set<Test> queryTestTasks(String testTaskPath) {
TaskSelection taskSelection;
try {
taskSelection = taskSelector.getSelection(testTaskPath);
} catch (TaskSelectionException e) {
throw new TestExecutionException(String.format("Requested test task with path '%s' cannot be found.", testTaskPath));
}
Set<Task> tasks = taskSelection.getTasks();
if (tasks.isEmpty()) {
throw new TestExecutionException(String.format("Requested test task with path '%s' cannot be found.", testTaskPath));
}
Set<Test> result = new LinkedHashSet<>();
for (Task task : tasks) {
if (!(task instanceof Test)) {
throw new TestExecutionException(String.format("Task '%s' of type '%s' not supported for executing tests via TestLauncher API.", testTaskPath, task.getClass().getName()));
}
result.add((Test) task);
}
return result;
}
Aggregations