Search in sources :

Example 1 with DefaultTaskFailureResult

use of org.gradle.tooling.internal.provider.events.DefaultTaskFailureResult in project gradle by gradle.

the class ClientForwardingTaskOperationListener method toTaskResult.

private static AbstractTaskResult toTaskResult(TaskInternal task, OperationResult result) {
    TaskStateInternal state = task.getState();
    long startTime = result.getStartTime();
    long endTime = result.getEndTime();
    if (state.getUpToDate()) {
        return new DefaultTaskSuccessResult(startTime, endTime, true, state.isFromCache(), state.getSkipMessage());
    } else if (state.getSkipped()) {
        return new DefaultTaskSkippedResult(startTime, endTime, state.getSkipMessage());
    } else {
        Throwable failure = result.getFailure();
        if (failure == null) {
            return new DefaultTaskSuccessResult(startTime, endTime, false, state.isFromCache(), "SUCCESS");
        } else {
            return new DefaultTaskFailureResult(startTime, endTime, Collections.singletonList(DefaultFailure.fromThrowable(failure)));
        }
    }
}
Also used : TaskStateInternal(org.gradle.api.internal.tasks.TaskStateInternal) DefaultTaskSuccessResult(org.gradle.tooling.internal.provider.events.DefaultTaskSuccessResult) DefaultTaskSkippedResult(org.gradle.tooling.internal.provider.events.DefaultTaskSkippedResult) DefaultTaskFailureResult(org.gradle.tooling.internal.provider.events.DefaultTaskFailureResult)

Aggregations

TaskStateInternal (org.gradle.api.internal.tasks.TaskStateInternal)1 DefaultTaskFailureResult (org.gradle.tooling.internal.provider.events.DefaultTaskFailureResult)1 DefaultTaskSkippedResult (org.gradle.tooling.internal.provider.events.DefaultTaskSkippedResult)1 DefaultTaskSuccessResult (org.gradle.tooling.internal.provider.events.DefaultTaskSuccessResult)1