use of org.gradle.util.NameMatcher in project gradle by gradle.
the class TaskSelector method getSelection.
private TaskSelection getSelection(String path, ProjectInternal project) {
ResolvedTaskPath taskPath = taskPathResolver.resolvePath(path, project);
ProjectInternal targetProject = taskPath.getProject();
if (taskPath.isQualified()) {
configurer.configure(targetProject);
} else {
configurer.configureHierarchy(targetProject);
}
TaskSelectionResult tasks = taskNameResolver.selectWithName(taskPath.getTaskName(), taskPath.getProject(), !taskPath.isQualified());
if (tasks != null) {
// An exact match
return new TaskSelection(taskPath.getProject().getPath(), path, tasks);
}
Map<String, TaskSelectionResult> tasksByName = taskNameResolver.selectAll(taskPath.getProject(), !taskPath.isQualified());
NameMatcher matcher = new NameMatcher();
String actualName = matcher.find(taskPath.getTaskName(), tasksByName.keySet());
if (actualName != null) {
return new TaskSelection(taskPath.getProject().getPath(), taskPath.getPrefix() + actualName, tasksByName.get(actualName));
}
throw new TaskSelectionException(matcher.formatErrorMessage("task", taskPath.getProject()));
}
Aggregations