Package org.gradle.api.tasks

Examples of org.gradle.api.tasks.TaskContainer


     * @param taskArray the tasks to attach to the parent. these must be mock objects. Pass in null or an empty array to
     * set no tasks.
    */
    public static void attachTasks(JUnit4Mockery context, final Project parentProject, Task... taskArray) {
        //first, make our project return our task container
        final TaskContainer taskContainer = context.mock(TaskContainer.class, "[taskcontainer]_" + parentProject.getName() + '_' + uniqueNameCounter++);

        context.checking(new Expectations() {{
            allowing(parentProject).getTasks();
            will(returnValue(taskContainer));
        }});
View Full Code Here


    }
   
    private void expectTaskLookupInOtherProject(final String projectPath, final String taskName, final Task task) {
        context.checking(new Expectations() {{
            Project otherProject = context.mock(Project.class);
            TaskContainer otherTaskContainer = context.mock(TaskContainer.class);

            allowing(project).findProject(projectPath);
            will(returnValue(otherProject));

            allowing(otherProject).getTasks();
View Full Code Here

        final ProjectDependency projectDependencyStub = context.mock(ProjectDependency.class);
        superConfig.addDependency(projectDependencyStub);

        final Project projectStub = context.mock(Project.class);
        final TaskContainer taskContainerStub = context.mock(TaskContainer.class);
        final Task taskStub = context.mock(Task.class);
        final String taskName = "testit";

        context.checking(new Expectations() {{
            allowing(projectDependencyStub).getDependencyProject(); will(returnValue(projectStub));
View Full Code Here

        }
    }

    protected void setDefaultIvyDescriptor() {
        Project project = getProject();
        TaskContainer tasks = project.getTasks();
        Configuration archiveConfig = project.getConfigurations().findByName(Dependency.ARCHIVES_CONFIGURATION);
        if (archiveConfig == null) {
            log.warn("Cannot publish Ivy descriptor if ivyDescriptor not set in task '{}' " +
                    "and no '{}' configuration exists in project '{}'.", Dependency.ARCHIVES_CONFIGURATION,
                    project.getPath());
        } else {
            // Flag to publish the Ivy XML file, but no ivy descriptor file inputted, activate default upload${configuration}.
            // ATTENTION: Tasks not part of the execution graph have withType(Upload.class) false ?!? Need to check for type our self.
            Task candidateUploadTask = tasks.findByName(archiveConfig.getUploadTaskName());
            if (candidateUploadTask == null) {
                log.warn("Cannot publish Ivy descriptor if ivyDescriptor not set in task '{}' " +
                        "and task '{}' does not exist." +
                        "\nAdding \"apply plugin: 'java'\" or any other plugin extending the 'base' plugin" +
                        "will solve this issue.",
View Full Code Here

    protected void setDefaultMavenDescriptor() {
        // Flag to publish the Maven POM, but no pom file inputted, activate default Maven install.
        // if the project doesn't have the maven install task, warn
        Project project = getProject();
        TaskContainer tasks = project.getTasks();
        Upload installTask = tasks.withType(Upload.class).findByName("install");
        if (installTask == null) {
            log.warn("Cannot publish pom for project '{}' since it does not contain the Maven " +
                    "plugin install task and task '{}' does not specify a custom pom path.",
                    new Object[]{project.getPath(), getPath()});
            mavenDescriptor = null;
View Full Code Here

     * @param parentProject where to attach the sub projects. This must be a mock object.
     * @param taskArray the tasks to attach to the root. these must be mock objects. Pass in null or an empty array to set no tasks.
     */
    public static void attachTasks(JUnit4Mockery context, final Project parentProject, Task... taskArray) {
        //first, make our project return our task container
        final TaskContainer taskContainer = context.mock(TaskContainer.class, "[taskcontainer]_" + parentProject.getName() + '_' + uniqueNameCounter++);

        context.checking(new Expectations() {{
            allowing(parentProject).getTasks();
            will(returnValue(taskContainer));
        }});
View Full Code Here

    }

    public void apply(final Project project) {
        project.apply(Collections.singletonMap("plugin", PublishingPlugin.class));

        final TaskContainer tasks = project.getTasks();
        final Task publishLocalLifecycleTask = tasks.create(PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);
        publishLocalLifecycleTask.setDescription("Publishes all Maven publications produced by this project to the local Maven cache.");
        publishLocalLifecycleTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);

        // Can't move this to rules yet, because it has to happen before user deferred configurable actions
        project.getExtensions().configure(PublishingExtension.class, new Action<PublishingExtension>() {
View Full Code Here

TOP

Related Classes of org.gradle.api.tasks.TaskContainer

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.