use of org.gradle.api.tasks.StopActionException 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();
}
}
}
use of org.gradle.api.tasks.StopActionException in project gradle by gradle.
the class ExecuteActionsTaskExecuter method executeActions.
private GradleException executeActions(TaskInternal task, TaskStateInternal state, TaskExecutionContext context) {
LOGGER.debug("Executing actions for {}.", task);
final List<ContextAwareTaskAction> actions = new ArrayList<ContextAwareTaskAction>(task.getTaskActions());
for (ContextAwareTaskAction action : actions) {
state.setDidWork(true);
task.getStandardOutputCapture().start();
try {
executeAction(action.getDisplayName(), task, action, context);
} 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;
} catch (Throwable t) {
return new TaskExecutionException(task, t);
} finally {
task.getStandardOutputCapture().stop();
}
}
return null;
}
Aggregations