use of org.grails.cli.gradle.FetchAllTaskSelectorsBuildAction.AllTasksModel in project grails-core by grails.
the class FetchAllTaskSelectorsBuildAction method execute.
public AllTasksModel execute(BuildController controller) {
AllTasksModel model = new AllTasksModel();
Map<String, Set<String>> allTaskSelectors = new LinkedHashMap<String, Set<String>>();
model.allTaskSelectors = allTaskSelectors;
Map<String, Set<String>> allTasks = new LinkedHashMap<String, Set<String>>();
model.allTasks = allTasks;
Map<String, String> projectPaths = new HashMap<String, String>();
model.projectPaths = projectPaths;
for (BasicGradleProject project : controller.getBuildModel().getProjects()) {
BuildInvocations entryPointsForProject = controller.getModel(project, BuildInvocations.class);
Set<String> selectorNames = new LinkedHashSet<String>();
for (TaskSelector selector : entryPointsForProject.getTaskSelectors()) {
selectorNames.add(selector.getName());
}
allTaskSelectors.put(project.getName(), selectorNames);
Set<String> taskNames = new LinkedHashSet<String>();
for (Task task : entryPointsForProject.getTasks()) {
taskNames.add(task.getName());
}
allTasks.put(project.getName(), taskNames);
projectPaths.put(project.getName(), project.getPath());
if (project.getProjectDirectory().getAbsolutePath().equals(currentProjectPath)) {
model.currentProject = project.getName();
}
}
return model;
}
Aggregations