use of org.gradle.internal.build.event.types.AbstractTaskResult in project gradle by gradle.
the class TaskOperationMapper method createFinishedEvent.
@Override
public InternalOperationFinishedProgressEvent createFinishedEvent(DefaultTaskDescriptor descriptor, ExecuteTaskBuildOperationDetails details, OperationFinishEvent finishEvent) {
TaskInternal task = details.getTask();
AbstractTaskResult taskResult = operationResultPostProcessor.process(toTaskResult(task, finishEvent), descriptor.getId());
return new DefaultTaskFinishedProgressEvent(finishEvent.getEndTime(), descriptor, taskResult);
}
use of org.gradle.internal.build.event.types.AbstractTaskResult in project gradle by gradle.
the class TaskOperationMapper method toTaskResult.
private static AbstractTaskResult toTaskResult(TaskInternal task, OperationFinishEvent finishEvent) {
TaskStateInternal state = task.getState();
long startTime = finishEvent.getStartTime();
long endTime = finishEvent.getEndTime();
ExecuteTaskBuildOperationType.Result result = (ExecuteTaskBuildOperationType.Result) finishEvent.getResult();
boolean incremental = result != null && result.isIncremental();
if (state.getUpToDate()) {
return new DefaultTaskSuccessResult(startTime, endTime, true, state.isFromCache(), state.getSkipMessage(), incremental, Collections.emptyList());
} else if (state.getSkipped()) {
return new DefaultTaskSkippedResult(startTime, endTime, state.getSkipMessage(), incremental);
} else {
List<String> executionReasons = result != null ? result.getUpToDateMessages() : null;
Throwable failure = finishEvent.getFailure();
if (failure == null) {
return new DefaultTaskSuccessResult(startTime, endTime, false, state.isFromCache(), "SUCCESS", incremental, executionReasons);
} else {
return new DefaultTaskFailureResult(startTime, endTime, singletonList(DefaultFailure.fromThrowable(failure)), incremental, executionReasons);
}
}
}
Aggregations