Search in sources :

Example 1 with InternalBuildActionFailureException

use of org.gradle.tooling.internal.protocol.InternalBuildActionFailureException in project gradle by gradle.

the class ClientProvidedBuildActionRunner method buildResult.

private BuildActionResult buildResult(InternalBuildAction<?> clientAction, GradleInternal gradle, boolean isRunTasks) {
    if (!isRunTasks) {
        forceFullConfiguration(gradle);
    }
    InternalBuildController internalBuildController = new DefaultBuildController(gradle);
    Object model = null;
    Throwable failure = null;
    try {
        model = clientAction.execute(internalBuildController);
    } catch (BuildCancelledException e) {
        failure = new InternalBuildCancelledException(e);
    } catch (RuntimeException e) {
        failure = new InternalBuildActionFailureException(e);
    }
    PayloadSerializer payloadSerializer = getPayloadSerializer(gradle);
    if (failure != null) {
        return new BuildActionResult(null, payloadSerializer.serialize(failure));
    } else {
        return new BuildActionResult(payloadSerializer.serialize(model), null);
    }
}
Also used : InternalBuildController(org.gradle.tooling.internal.protocol.InternalBuildController) PayloadSerializer(org.gradle.tooling.internal.provider.serialization.PayloadSerializer) InternalBuildActionFailureException(org.gradle.tooling.internal.protocol.InternalBuildActionFailureException) BuildActionResult(org.gradle.tooling.internal.provider.BuildActionResult) InternalBuildCancelledException(org.gradle.tooling.internal.protocol.InternalBuildCancelledException) BuildCancelledException(org.gradle.api.BuildCancelledException) InternalBuildCancelledException(org.gradle.tooling.internal.protocol.InternalBuildCancelledException)

Aggregations

BuildCancelledException (org.gradle.api.BuildCancelledException)1 InternalBuildActionFailureException (org.gradle.tooling.internal.protocol.InternalBuildActionFailureException)1 InternalBuildCancelledException (org.gradle.tooling.internal.protocol.InternalBuildCancelledException)1 InternalBuildController (org.gradle.tooling.internal.protocol.InternalBuildController)1 BuildActionResult (org.gradle.tooling.internal.provider.BuildActionResult)1 PayloadSerializer (org.gradle.tooling.internal.provider.serialization.PayloadSerializer)1