Search in sources :

Example 21 with GradleInternal

use of org.gradle.api.internal.GradleInternal in project gradle by gradle.

the class ClientProvidedBuildActionRunner method run.

@Override
public void run(BuildAction action, final BuildController buildController) {
    if (!(action instanceof ClientProvidedBuildAction)) {
        return;
    }
    final GradleInternal gradle = buildController.getGradle();
    gradle.getStartParameter().setConfigureOnDemand(false);
    ClientProvidedBuildAction clientProvidedBuildAction = (ClientProvidedBuildAction) action;
    PayloadSerializer payloadSerializer = getPayloadSerializer(gradle);
    final Object clientAction = payloadSerializer.deserialize(clientProvidedBuildAction.getAction());
    gradle.addBuildListener(new BuildAdapter() {

        @Override
        public void buildFinished(BuildResult result) {
            if (result.getFailure() == null) {
                buildController.setResult(buildResult(clientAction, gradle));
            }
        }
    });
    if (clientProvidedBuildAction.isRunTasks()) {
        buildController.run();
    } else {
        buildController.configure();
    }
}
Also used : GradleInternal(org.gradle.api.internal.GradleInternal) BuildResult(org.gradle.BuildResult) PayloadSerializer(org.gradle.tooling.internal.provider.serialization.PayloadSerializer) ClientProvidedBuildAction(org.gradle.tooling.internal.provider.ClientProvidedBuildAction) BuildAdapter(org.gradle.BuildAdapter)

Aggregations

GradleInternal (org.gradle.api.internal.GradleInternal)21 StartParameter (org.gradle.StartParameter)4 ServiceRegistryFactory (org.gradle.internal.service.scopes.ServiceRegistryFactory)3 Task (org.gradle.api.Task)2 ExceptionAnalyser (org.gradle.api.internal.ExceptionAnalyser)2 ProjectInternal (org.gradle.api.internal.project.ProjectInternal)2 ShowStacktrace (org.gradle.api.logging.configuration.ShowStacktrace)2 BuildConfigurer (org.gradle.configuration.BuildConfigurer)2 BuildConfigurationActionExecuter (org.gradle.execution.BuildConfigurationActionExecuter)2 BuildExecuter (org.gradle.execution.BuildExecuter)2 GradleLauncher (org.gradle.initialization.GradleLauncher)2 BuildLogger (org.gradle.internal.buildevents.BuildLogger)2 TaskExecutionLogger (org.gradle.internal.buildevents.TaskExecutionLogger)2 ListenerManager (org.gradle.internal.event.ListenerManager)2 ScriptUsageLocationReporter (org.gradle.internal.featurelifecycle.ScriptUsageLocationReporter)2 BuildOperationExecutor (org.gradle.internal.operations.BuildOperationExecutor)2 LoggerProvider (org.gradle.internal.progress.LoggerProvider)2 Instantiator (org.gradle.internal.reflect.Instantiator)2 BuildScopeServices (org.gradle.internal.service.scopes.BuildScopeServices)2 ProfileEventAdapter (org.gradle.profile.ProfileEventAdapter)2