Search in sources :

Example 1 with InputChangesAwareTaskAction

use of org.gradle.api.internal.tasks.InputChangesAwareTaskAction in project gradle by gradle.

the class TaskExecution method executeActions.

private void executeActions(TaskInternal task, @Nullable InputChangesInternal inputChanges) {
    boolean hasTaskListener = listenerManager.hasListeners(org.gradle.api.execution.TaskActionListener.class) || listenerManager.hasListeners(org.gradle.api.execution.TaskExecutionListener.class);
    Iterator<InputChangesAwareTaskAction> actions = new ArrayList<>(task.getTaskActions()).iterator();
    while (actions.hasNext()) {
        InputChangesAwareTaskAction action = actions.next();
        task.getState().setDidWork(true);
        task.getStandardOutputCapture().start();
        boolean hasMoreWork = hasTaskListener || actions.hasNext();
        try {
            executeAction(action.getDisplayName(), task, action, inputChanges, hasMoreWork);
        } catch (StopActionException e) {
            // Ignore
            LOGGER.debug("Action stopped by some action with message: {}", e.getMessage());
        } catch (StopExecutionException e) {
            LOGGER.info("Execution stopped by some action with message: {}", e.getMessage());
            break;
        } finally {
            task.getStandardOutputCapture().stop();
        }
    }
}
Also used : InputChangesAwareTaskAction(org.gradle.api.internal.tasks.InputChangesAwareTaskAction) StopExecutionException(org.gradle.api.tasks.StopExecutionException) StopActionException(org.gradle.api.tasks.StopActionException)

Example 2 with InputChangesAwareTaskAction

use of org.gradle.api.internal.tasks.InputChangesAwareTaskAction in project gradle by gradle.

the class TaskExecution method visitImplementations.

@Override
public void visitImplementations(ImplementationVisitor visitor) {
    visitor.visitImplementation(task.getClass());
    List<InputChangesAwareTaskAction> taskActions = task.getTaskActions();
    for (InputChangesAwareTaskAction taskAction : taskActions) {
        visitor.visitImplementation(taskAction.getActionImplementation(classLoaderHierarchyHasher));
    }
}
Also used : InputChangesAwareTaskAction(org.gradle.api.internal.tasks.InputChangesAwareTaskAction)

Aggregations

InputChangesAwareTaskAction (org.gradle.api.internal.tasks.InputChangesAwareTaskAction)2 StopActionException (org.gradle.api.tasks.StopActionException)1 StopExecutionException (org.gradle.api.tasks.StopExecutionException)1