@Override public synchronized void afterExecute(Task task, TaskState state) { if (isUntracked(task)) { Report.TestCase.Builder testCase = new Report.TestCase.Builder() .name(":" + task.getProject().getName() + ":" + task.getName()); Throwable failure = state.getFailure(); if (failure != null && isUntracked(task)) { if (failure instanceof TaskExecutionException && failure.getCause() != null) { failure = failure.getCause(); } StringWriter stackTrace = new StringWriter(); failure.printStackTrace(new PrintWriter(stackTrace)); testCase.failure(new Report.Failure.Builder() .message(getMessage(failure)) .details(stackTrace.toString()) .build()); } testCases.add(testCase.build()); } }
@Override public void afterExecute(Task task, TaskState state) { if (state.getFailure() != null) { lastFailed = task; failed.add(task); } }
public void afterExecute(Task task, TaskState state) { String taskPath = path(task); if (taskPath.startsWith(":buildSrc:")) { return; } if (state.getSkipped()) { skippedTasks.add(taskPath); } }
@Override public void afterExecute(Task task, TaskState state) { TaskStateInternal stateInternal = (TaskStateInternal) state; TaskExecutionOutcome outcome = stateInternal.getOutcome(); taskCounts.put(outcome, taskCounts.get(outcome) + 1); if (stateInternal.isCacheable() && outcome == TaskExecutionOutcome.EXECUTED) { cacheMissCount++; } }
public void afterExecute(Task task, TaskState state) { long now = timeProvider.getCurrentTime(); Project project = task.getProject(); ProjectProfile projectProfile = buildProfile.getProjectProfile(project.getPath()); TaskExecution taskExecution = projectProfile.getTaskProfile(task.getPath()); taskExecution.setFinish(now); taskExecution.completed(state); }
public void afterTask(final Action<Task> action) { taskListeners.add(new TaskExecutionAdapter() { @Override public void afterExecute(Task task, TaskState state) { action.execute(task); } }); }
@VisibleForTesting Result getTaskExecutionResult(TaskExecution taskExecution) { Result result = Result.success(); TaskState state = taskExecution.getState(); if (state == null || !state.getDidWork()) { result = Result.skipped(); } else { //noinspection ThrowableResultOfMethodCallIgnored Throwable failure = state.getFailure(); if (failure != null) { result = Result.failure(failure); } } return result; }
@Override public void afterExecute(Task task, TaskState taskState) { if (isStyleTask(task)) { taskTimeNanosByTask.put(task, System.nanoTime() - lastStartTime); } }
private static TaskState succeeded() { TaskStateInternal state = new TaskStateInternal(); state.setOutcome(TaskExecutionOutcome.EXECUTED); return state; }
private static TaskState failed(String message) { TaskStateInternal state = new TaskStateInternal(); state.setOutcome(TaskExecutionOutcome.EXECUTED); state.setOutcome(new RuntimeException(message)); return state; }
public void afterExecute(Task task, TaskState state) { totalTasksExecuted++; percentComplete = (totalTasksExecuted / totalTasksToExecute) * 100; String currentTaskName = task.getProject().getName() + ":" + task.getName(); client.sendMessage(ProtocolConstants.TASK_COMPLETE_TYPE, currentTaskName, new Float(percentComplete)); }
public TaskState getState() { return state; }
public TaskExecution completed(TaskState state) { this.state = state; return this; }
public void afterExecute(Task task, TaskState state) { ProgressLogger currentTask = currentTasks.remove(task); String taskMessage = state.getFailure() != null ? "FAILED" : state.getSkipMessage(); currentTask.completed(taskMessage); }
public void afterExecute(Task task, TaskState state) { if (task.getProject().getGradle() == gradle) { logger.afterExecute(); } }
/** * Returns the execution state of this task. This provides information about the execution of this task, such as * whether it has executed, been skipped, has failed, etc. * * @return The execution state of this task. Never returns null. */ TaskState getState();
/** * This method is call immediately after a task has been executed. It is always called, regardless of whether the * task completed successfully, or failed with an exception. * * @param task The task which was executed. Never null. * @param state The task state. If the task failed with an exception, the exception is available in this * state. Never null. */ void afterExecute(Task task, TaskState state);
public void afterExecute(Task task, TaskState state) {}