Package org.gradle.api.internal.tasks

Examples of org.gradle.api.internal.tasks.TaskContainerInternal


        final BuildExecuter delegate = context.mock(BuildExecuter.class);
        executer.setDelegate(delegate);

        context.checking(new Expectations(){{
            Task task = context.mock(Task.class);
            TaskContainerInternal taskContainer = context.mock(TaskContainerInternal.class);
            allowing(project).getSubprojects();
            will(returnValue(toSet()));
            allowing(project).getTasks();
            will(returnValue(taskContainer));
            one(taskContainer).findByName("b");
View Full Code Here


    public static final String TASKS_TASK = "tasks";
    public static final String DEPENDENCIES_TASK = "dependencies";
    public static final String PROPERTIES_TASK = "properties";

    public void execute(ProjectInternal project) {
        TaskContainerInternal tasks = project.getImplicitTasks();

        Task task = tasks.add(HELP_TASK, Help.class);
        task.setDescription("Displays a help message");
        task.setGroup(HELP_GROUP);

        task = tasks.add(PROJECTS_TASK, ProjectReportTask.class);
        task.setDescription(String.format("Displays the sub-projects of %s.", project));
        task.setGroup(HELP_GROUP);

        task = tasks.add(TASKS_TASK, TaskReportTask.class);
        task.setDescription(String.format("Displays the tasks in %s.", project));
        task.setGroup(HELP_GROUP);

        task = tasks.add(DEPENDENCIES_TASK, DependencyReportTask.class);
        task.setDescription(String.format("Displays the dependencies of %s.", project));
        task.setGroup(HELP_GROUP);

        task = tasks.add(PROPERTIES_TASK, PropertyReportTask.class);
        task.setDescription(String.format("Displays the properties of %s.", project));
        task.setGroup(HELP_GROUP);
    }
View Full Code Here

import java.util.Collection;

public class DefaultProjectTaskLister implements ProjectTaskLister {
    public Collection<Task> listProjectTasks(Project project) {
        ProjectInternal projectInternal = (ProjectInternal) project;
        TaskContainerInternal tasks = projectInternal.getTasks();
        tasks.actualize();
        return tasks;
    }
View Full Code Here

    public static final String DEPENDENCIES_TASK = "dependencies";
    public static final String DEPENDENCY_INSIGHT_TASK = "dependencyInsight";
    public static final String COMPONENTS_TASK = "components";

    public void apply(final ProjectInternal project) {
        final TaskContainerInternal tasks = project.getTasks();

        tasks.addPlaceholderAction(ProjectInternal.HELP_TASK, new Runnable() {
            public void run() {
                tasks.create(ProjectInternal.HELP_TASK, Help.class, new Action<Help>() {
                    public void execute(Help task) {
                        task.setDescription("Displays a help message.");
                        task.setGroup(HELP_GROUP);
                        task.setImpliesSubProjects(true);
                    }
                });
            }
        });

        tasks.addPlaceholderAction(ProjectInternal.PROJECTS_TASK, new Runnable() {
            public void run() {
                tasks.create(ProjectInternal.PROJECTS_TASK, ProjectReportTask.class, new Action<ProjectReportTask>() {
                    public void execute(ProjectReportTask task) {
                        task.setDescription("Displays the sub-projects of " + project + ".");
                        task.setGroup(HELP_GROUP);
                        task.setImpliesSubProjects(true);
                    }
                });
            }
        });

        tasks.addPlaceholderAction(ProjectInternal.TASKS_TASK, new Runnable() {
            public void run() {
                tasks.create(ProjectInternal.TASKS_TASK, TaskReportTask.class, new Action<TaskReportTask>() {
                    public void execute(TaskReportTask task) {
                        String description;
                        if (project.getChildProjects().isEmpty()) {
                            description = "Displays the tasks runnable from " + project + ".";
                        } else {
                            description = "Displays the tasks runnable from " + project + " (some of the displayed tasks may belong to subprojects).";
                        }
                        task.setDescription(description);
                        task.setGroup(HELP_GROUP);
                        task.setImpliesSubProjects(true);
                    }
                });
            }
        });

        tasks.addPlaceholderAction(PROPERTIES_TASK, new Runnable() {
            public void run() {
                tasks.create(PROPERTIES_TASK, PropertyReportTask.class, new Action<PropertyReportTask>() {
                    public void execute(PropertyReportTask task) {
                        task.setDescription("Displays the properties of " + project + ".");
                        task.setGroup(HELP_GROUP);
                        task.setImpliesSubProjects(true);
                    }
                });
            }
        });

        tasks.addPlaceholderAction(DEPENDENCY_INSIGHT_TASK, new Runnable() {
            public void run() {
                tasks.create(DEPENDENCY_INSIGHT_TASK, DependencyInsightReportTask.class, new Action<DependencyInsightReportTask>() {
                    public void execute(final DependencyInsightReportTask task) {
                        task.setDescription("Displays the insight into a specific dependency in " + project + ".");
                        task.setGroup(HELP_GROUP);
                        task.setImpliesSubProjects(true);

                        project.getPlugins().withType(JavaPlugin.class, new Action<JavaPlugin>() {
                            public void execute(JavaPlugin javaPlugin) {
                                task.setConfiguration(project.getConfigurations().getByName(JavaPlugin.COMPILE_CONFIGURATION_NAME));
                            }
                        });
                    }
                });
            }
        });

        tasks.addPlaceholderAction(DEPENDENCIES_TASK, new Runnable() {
            public void run() {
                tasks.create(DEPENDENCIES_TASK, DependencyReportTask.class, new Action<DependencyReportTask>() {
                    public void execute(DependencyReportTask task) {
                        task.setDescription("Displays all dependencies declared in " + project + ".");
                        task.setGroup(HELP_GROUP);
                        task.setImpliesSubProjects(true);
                    }
                });
            }
        });

        tasks.addPlaceholderAction(COMPONENTS_TASK, new Runnable() {
            public void run() {
                tasks.create(COMPONENTS_TASK, ComponentReport.class, new Action<ComponentReport>() {
                    public void execute(ComponentReport task) {
                        task.setDescription("Displays the components produced by " + project + ". [incubating]");
                        task.setGroup(HELP_GROUP);
                        task.setImpliesSubProjects(true);
                    }
View Full Code Here

TOP

Related Classes of org.gradle.api.internal.tasks.TaskContainerInternal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.