Search in sources :

Example 1 with BuildInvocations

use of org.gradle.tooling.model.gradle.BuildInvocations in project gradle by gradle.

the class FetchIncludedBuildInvocations method execute.

@Override
public List<BuildInvocations> execute(BuildController controller) {
    List<BuildInvocations> invocations = new ArrayList<BuildInvocations>();
    GradleBuild build = controller.getBuildModel();
    for (GradleBuild includedBuild : build.getIncludedBuilds()) {
        invocations.add(controller.getModel(includedBuild, BuildInvocations.class));
    }
    return invocations;
}
Also used : ArrayList(java.util.ArrayList) BuildInvocations(org.gradle.tooling.model.gradle.BuildInvocations) GradleBuild(org.gradle.tooling.model.gradle.GradleBuild)

Example 2 with BuildInvocations

use of org.gradle.tooling.model.gradle.BuildInvocations 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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Task(org.gradle.tooling.model.Task) Set(java.util.Set) LinkedHashSet(java.util.LinkedHashSet) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) BasicGradleProject(org.gradle.tooling.model.gradle.BasicGradleProject) BuildInvocations(org.gradle.tooling.model.gradle.BuildInvocations) TaskSelector(org.gradle.tooling.model.TaskSelector) LinkedHashMap(java.util.LinkedHashMap) AllTasksModel(org.grails.cli.gradle.FetchAllTaskSelectorsBuildAction.AllTasksModel)

Example 3 with BuildInvocations

use of org.gradle.tooling.model.gradle.BuildInvocations in project gradle by gradle.

the class FetchAllTaskSelectorsBuildAction method execute.

public Map<String, Set<String>> execute(BuildController controller) {
    Map<String, Set<String>> model = new HashMap<String, Set<String>>();
    for (BasicGradleProject project : controller.getBuildModel().getProjects()) {
        BuildInvocations entryPointsForProject = controller.getModel(project, BuildInvocations.class);
        Set<String> selectorNames = new HashSet<String>();
        for (TaskSelector selector : entryPointsForProject.getTaskSelectors()) {
            selectorNames.add(selector.getName());
        }
        model.put(project.getName(), selectorNames);
    }
    return model;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) BasicGradleProject(org.gradle.tooling.model.gradle.BasicGradleProject) BuildInvocations(org.gradle.tooling.model.gradle.BuildInvocations) TaskSelector(org.gradle.tooling.model.TaskSelector) HashSet(java.util.HashSet)

Aggregations

BuildInvocations (org.gradle.tooling.model.gradle.BuildInvocations)3 HashMap (java.util.HashMap)2 Set (java.util.Set)2 TaskSelector (org.gradle.tooling.model.TaskSelector)2 BasicGradleProject (org.gradle.tooling.model.gradle.BasicGradleProject)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Task (org.gradle.tooling.model.Task)1 GradleBuild (org.gradle.tooling.model.gradle.GradleBuild)1 AllTasksModel (org.grails.cli.gradle.FetchAllTaskSelectorsBuildAction.AllTasksModel)1