Search in sources :

Example 1 with DefaultTaskSkippedResult

use of org.gradle.tooling.internal.provider.events.DefaultTaskSkippedResult 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)

Example 2 with DefaultTaskSkippedResult

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

the class ClientForwardingTaskOperationListener method toTaskResult.

private static AbstractTaskResult toTaskResult(TaskInternal task, OperationFinishEvent 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)2 DefaultTaskFailureResult (org.gradle.tooling.internal.provider.events.DefaultTaskFailureResult)2 DefaultTaskSkippedResult (org.gradle.tooling.internal.provider.events.DefaultTaskSkippedResult)2 DefaultTaskSuccessResult (org.gradle.tooling.internal.provider.events.DefaultTaskSuccessResult)2