use of org.gradle.tooling.internal.protocol.InternalBuildActionVersion2 in project gradle by gradle.
the class ClientProvidedBuildActionRunner method buildResult.
@SuppressWarnings("deprecation")
private BuildActionResult buildResult(Object clientAction, GradleInternal gradle) {
forceFullConfiguration(gradle);
DefaultBuildController internalBuildController = new DefaultBuildController(gradle);
Object model = null;
Throwable failure = null;
try {
if (clientAction instanceof InternalBuildActionVersion2<?>) {
model = ((InternalBuildActionVersion2) clientAction).execute(internalBuildController);
} else {
model = ((org.gradle.tooling.internal.protocol.InternalBuildAction) 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);
}
}
Aggregations