Package org.gradle.api.internal

Examples of org.gradle.api.internal.TaskInternal


        taskExecuter.addTasks(toList(c));
        assertThat(taskExecuter.getAllTasks(), equalTo(toList(b, c)));
    }

    private Task createTask(String name, final Task... dependsOn) {
        final TaskInternal task = AbstractTask.injectIntoNewInstance(root, name, new Callable<TaskInternal>() {
            public TaskInternal call() throws Exception {
                return new DefaultTask();
            }
        });
        task.dependsOn((Object[]) dependsOn);
        task.doFirst(new Action<Task>() {
            public void execute(Task task) {
                executedTasks.add(task);
            }
        });
        return task;
View Full Code Here


    public AnnotationProcessingTaskFactory(ITaskFactory taskFactory) {
        this.taskFactory = taskFactory;
    }

    public TaskInternal createTask(ProjectInternal project, Map<String, ?> args) {
        TaskInternal task = taskFactory.createTask(project, args);

        Class<? extends Task> type = task.getClass();
        List<Action<Task>> actions = actionsForType.get(type);
        if (actions == null) {
            actions = createActionsForType(type);
            actionsForType.put(type, actions);
        }

        for (Action<Task> action : actions) {
            task.doFirst(action);
            if (action instanceof Validator) {
                Validator validator = (Validator) action;
                validator.addInputsAndOutputs(task);
            }
        }
View Full Code Here

    public TaskInternal createTask(ProjectInternal project, Map<String, ?> args) {
        Map<String, Object> actualArgs = new HashMap<String, Object>(args);
        boolean autoWire = remove(actualArgs, DEPENDENCY_AUTO_WIRE);

        TaskInternal task = taskFactory.createTask(project, actualArgs);
        if (autoWire) {
            task.dependsOn(task.getInputs().getFiles());
        }
        return task;
    }
View Full Code Here

            throw new InvalidUserDataException("The task name must be provided.");
        }

        Class<? extends TaskInternal> type = (Class) actualArgs.get(Task.TASK_TYPE);
        Boolean generateSubclass = Boolean.valueOf(actualArgs.get(GENERATE_SUBCLASS).toString());
        TaskInternal task = createTaskObject(project, type, name, generateSubclass);

        Object dependsOnTasks = actualArgs.get(Task.TASK_DEPENDS_ON);
        if (dependsOnTasks != null) {
            task.dependsOn(dependsOnTasks);
        }
        Object description = actualArgs.get(Task.TASK_DESCRIPTION);
        if (description != null) {
            task.setDescription(description.toString());
        }
        Object action = actualArgs.get(Task.TASK_ACTION);
        if (action instanceof Action) {
            Action<? super Task> taskAction = (Action<? super Task>) action;
            task.doFirst(taskAction);
        } else if (action != null) {
            Closure closure = (Closure) action;
            task.doFirst(closure);
        }

        return task;
    }
View Full Code Here

        return task;
    }

    @Test
    public void doesNothingToTaskWithNoTaskActionAnnotations() {
        TaskInternal task = expectTaskCreated(DefaultTask.class);

        assertThat(task.getActions(), isEmpty());
    }
View Full Code Here

    @Test
    public void artifactsAreNotUpToDateWhenAnyOutputFilesAddedToSet() {
        execute();

        TaskInternal task = builder().withOutputFiles(outputFile, outputDir, tmpDir.createFile("output-file-2"), emptyOutputDir, missingOutputFile).task();

        TaskArtifactState state = repository.getStateFor(task);
        assertFalse(state.isUpToDate());
    }
View Full Code Here

    @Test
    public void artifactsAreNotUpToDateWhenAnyOutputFilesRemovedFromSet() {
        execute();

        TaskInternal task = builder().withOutputFiles(outputFile, emptyOutputDir, missingOutputFile).task();

        TaskArtifactState state = repository.getStateFor(task);
        assertFalse(state.isUpToDate());
    }
View Full Code Here

        assertFalse(state.isUpToDate());
    }

    @Test
    public void artifactsAreNotUpToDateWhenTaskWithDifferentTypeGeneratedAnyOutputFiles() {
        TaskInternal task1 = builder().withOutputFiles(outputFile).task();
        TaskInternal task2 = builder().withType(TaskSubType.class).withOutputFiles(outputFile).task();

        execute(task1, task2);

        TaskArtifactState state = repository.getStateFor(task1);
        assertFalse(state.isUpToDate());
View Full Code Here

    @Test
    public void artifactsAreNotUpToDateWhenAnyInputFilesAddedToSet() {
        execute();

        TaskInternal task = builder().withInputFiles(inputFile, inputDir, tmpDir.createFile("other-input"), missingInputFile).task();
        TaskArtifactState state = repository.getStateFor(task);
        assertFalse(state.isUpToDate());
    }
View Full Code Here

    @Test
    public void artifactsAreNotUpToDateWhenAnyInputFilesRemovedFromSet() {
        execute();

        TaskInternal task = builder().withInputFiles(inputFile).task();
        TaskArtifactState state = repository.getStateFor(task);
        assertFalse(state.isUpToDate());
    }
View Full Code Here

TOP

Related Classes of org.gradle.api.internal.TaskInternal

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.