Search in sources :

Example 1 with InternalPhasedAction

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

the class PhasedActionAwareConsumerConnection method run.

@Override
public void run(PhasedBuildAction phasedBuildAction, ConsumerOperationParameters operationParameters) {
    InternalPhasedActionConnection connection = (InternalPhasedActionConnection) getDelegate();
    PhasedActionResultListener listener = new DefaultPhasedActionResultListener(getHandler(phasedBuildAction.getProjectsLoadedAction()), getHandler(phasedBuildAction.getBuildFinishedAction()));
    InternalPhasedAction internalPhasedAction = getPhasedAction(phasedBuildAction, operationParameters.getProjectDir(), getVersionDetails());
    try {
        connection.run(internalPhasedAction, listener, new BuildCancellationTokenAdapter(operationParameters.getCancellationToken()), operationParameters);
    } catch (InternalBuildActionFailureException e) {
        throw new BuildActionFailureException("The supplied phased action failed with an exception.", e.getCause());
    }
}
Also used : BuildActionFailureException(org.gradle.tooling.BuildActionFailureException) InternalBuildActionFailureException(org.gradle.tooling.internal.protocol.InternalBuildActionFailureException) InternalBuildActionFailureException(org.gradle.tooling.internal.protocol.InternalBuildActionFailureException) PhasedActionResultListener(org.gradle.tooling.internal.protocol.PhasedActionResultListener) DefaultPhasedActionResultListener(org.gradle.tooling.internal.consumer.DefaultPhasedActionResultListener) DefaultPhasedActionResultListener(org.gradle.tooling.internal.consumer.DefaultPhasedActionResultListener) BuildCancellationTokenAdapter(org.gradle.tooling.internal.consumer.parameters.BuildCancellationTokenAdapter) InternalPhasedAction(org.gradle.tooling.internal.protocol.InternalPhasedAction) InternalPhasedActionConnection(org.gradle.tooling.internal.protocol.InternalPhasedActionConnection)

Example 2 with InternalPhasedAction

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

the class ClientProvidedPhasedActionRunner method run.

@Override
public Result run(BuildAction action, BuildTreeLifecycleController buildController) {
    if (!(action instanceof ClientProvidedPhasedAction)) {
        return Result.nothing();
    }
    ClientProvidedPhasedAction clientProvidedPhasedAction = (ClientProvidedPhasedAction) action;
    InternalPhasedAction phasedAction = (InternalPhasedAction) payloadSerializer.deserialize(clientProvidedPhasedAction.getPhasedAction());
    return runClientAction(new ClientActionImpl(phasedAction, action), buildController);
}
Also used : ClientProvidedPhasedAction(org.gradle.tooling.internal.provider.action.ClientProvidedPhasedAction) InternalPhasedAction(org.gradle.tooling.internal.protocol.InternalPhasedAction)

Aggregations

InternalPhasedAction (org.gradle.tooling.internal.protocol.InternalPhasedAction)2 BuildActionFailureException (org.gradle.tooling.BuildActionFailureException)1 DefaultPhasedActionResultListener (org.gradle.tooling.internal.consumer.DefaultPhasedActionResultListener)1 BuildCancellationTokenAdapter (org.gradle.tooling.internal.consumer.parameters.BuildCancellationTokenAdapter)1 InternalBuildActionFailureException (org.gradle.tooling.internal.protocol.InternalBuildActionFailureException)1 InternalPhasedActionConnection (org.gradle.tooling.internal.protocol.InternalPhasedActionConnection)1 PhasedActionResultListener (org.gradle.tooling.internal.protocol.PhasedActionResultListener)1 ClientProvidedPhasedAction (org.gradle.tooling.internal.provider.action.ClientProvidedPhasedAction)1