Search in sources :

Example 1 with InternalBuildController

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

the class InternalBuildActionAdapter method execute.

public T execute(final InternalBuildController buildController) {
    ProtocolToModelAdapter protocolToModelAdapter = new ProtocolToModelAdapter(new ConsumerTargetTypeProvider());
    BuildController buildControllerAdapter = new BuildControllerAdapter(protocolToModelAdapter, buildController, new ModelMapping(), rootDir);
    if (!versionDetails.maySupportModel(BuildInvocations.class)) {
        buildControllerAdapter = new BuildInvocationsAdapterController(protocolToModelAdapter, buildControllerAdapter);
    }
    return action.execute(buildControllerAdapter);
}
Also used : ProtocolToModelAdapter(org.gradle.tooling.internal.adapter.ProtocolToModelAdapter) ConsumerTargetTypeProvider(org.gradle.tooling.internal.consumer.converters.ConsumerTargetTypeProvider) BuildInvocations(org.gradle.tooling.model.gradle.BuildInvocations) BuildController(org.gradle.tooling.BuildController) InternalBuildController(org.gradle.tooling.internal.protocol.InternalBuildController) ModelMapping(org.gradle.tooling.internal.consumer.versioning.ModelMapping)

Example 2 with InternalBuildController

use of org.gradle.tooling.internal.protocol.InternalBuildController 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

InternalBuildController (org.gradle.tooling.internal.protocol.InternalBuildController)2 BuildCancelledException (org.gradle.api.BuildCancelledException)1 BuildController (org.gradle.tooling.BuildController)1 ProtocolToModelAdapter (org.gradle.tooling.internal.adapter.ProtocolToModelAdapter)1 ConsumerTargetTypeProvider (org.gradle.tooling.internal.consumer.converters.ConsumerTargetTypeProvider)1 ModelMapping (org.gradle.tooling.internal.consumer.versioning.ModelMapping)1 InternalBuildActionFailureException (org.gradle.tooling.internal.protocol.InternalBuildActionFailureException)1 InternalBuildCancelledException (org.gradle.tooling.internal.protocol.InternalBuildCancelledException)1 BuildActionResult (org.gradle.tooling.internal.provider.BuildActionResult)1 PayloadSerializer (org.gradle.tooling.internal.provider.serialization.PayloadSerializer)1 BuildInvocations (org.gradle.tooling.model.gradle.BuildInvocations)1