Search in sources :

Example 1 with DefaultBuildInvocations

use of org.gradle.plugins.ide.internal.tooling.model.DefaultBuildInvocations in project gradle by gradle.

the class BuildInvocationsBuilder method buildAll.

@Override
@SuppressWarnings("StringEquality")
public DefaultBuildInvocations buildAll(String modelName, Project project) {
    if (!canBuild(modelName)) {
        throw new GradleException("Unknown model name " + modelName);
    }
    DefaultProjectIdentifier projectIdentifier = getProjectIdentifier(project);
    // construct task selectors
    List<LaunchableGradleTaskSelector> selectors = Lists.newArrayList();
    Map<String, LaunchableGradleTaskSelector> selectorsByName = Maps.newTreeMap(Ordering.natural());
    Set<String> visibleTasks = Sets.newLinkedHashSet();
    findTasks(project, selectorsByName, visibleTasks);
    for (String selectorName : selectorsByName.keySet()) {
        LaunchableGradleTaskSelector selector = selectorsByName.get(selectorName);
        selectors.add(selector.setName(selectorName).setTaskName(selectorName).setProjectIdentifier(projectIdentifier).setDisplayName(selectorName + " in " + project + " and subprojects.").setPublic(visibleTasks.contains(selectorName)));
    }
    // construct project tasks
    List<LaunchableGradleTask> projectTasks = tasks(project);
    // construct build invocations from task selectors and project tasks
    return new DefaultBuildInvocations().setSelectors(selectors).setTasks(projectTasks).setProjectIdentifier(projectIdentifier);
}
Also used : LaunchableGradleTask(org.gradle.plugins.ide.internal.tooling.model.LaunchableGradleTask) DefaultBuildInvocations(org.gradle.plugins.ide.internal.tooling.model.DefaultBuildInvocations) GradleException(org.gradle.api.GradleException) LaunchableGradleTaskSelector(org.gradle.plugins.ide.internal.tooling.model.LaunchableGradleTaskSelector) DefaultProjectIdentifier(org.gradle.tooling.internal.gradle.DefaultProjectIdentifier)

Aggregations

GradleException (org.gradle.api.GradleException)1 DefaultBuildInvocations (org.gradle.plugins.ide.internal.tooling.model.DefaultBuildInvocations)1 LaunchableGradleTask (org.gradle.plugins.ide.internal.tooling.model.LaunchableGradleTask)1 LaunchableGradleTaskSelector (org.gradle.plugins.ide.internal.tooling.model.LaunchableGradleTaskSelector)1 DefaultProjectIdentifier (org.gradle.tooling.internal.gradle.DefaultProjectIdentifier)1