Search in sources :

Example 11 with GradleInternal

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

the class SelectedTaskExecutionAction method execute.

public void execute(BuildExecutionContext context) {
    GradleInternal gradle = context.getGradle();
    TaskGraphExecuter taskGraph = gradle.getTaskGraph();
    if (gradle.getStartParameter().isContinueOnFailure()) {
        taskGraph.useFailureHandler(new ContinueOnFailureHandler());
    }
    taskGraph.addTaskExecutionGraphListener(new BindAllReferencesOfProjectsToExecuteListener());
    taskGraph.execute();
}
Also used : GradleInternal(org.gradle.api.internal.GradleInternal)

Example 12 with GradleInternal

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

the class ClientProvidedBuildActionRunner method forceFullConfiguration.

private void forceFullConfiguration(GradleInternal gradle) {
    try {
        gradle.getServices().get(ProjectConfigurer.class).configureHierarchyFully(gradle.getRootProject());
        for (IncludedBuild includedBuild : gradle.getIncludedBuilds()) {
            GradleInternal build = ((IncludedBuildInternal) includedBuild).getConfiguredBuild();
            forceFullConfiguration(build);
        }
    } catch (BuildCancelledException e) {
        throw new InternalBuildCancelledException(e);
    } catch (RuntimeException e) {
        throw new BuildExceptionVersion1(e);
    }
}
Also used : IncludedBuildInternal(org.gradle.composite.internal.IncludedBuildInternal) GradleInternal(org.gradle.api.internal.GradleInternal) BuildExceptionVersion1(org.gradle.tooling.internal.protocol.BuildExceptionVersion1) ProjectConfigurer(org.gradle.execution.ProjectConfigurer) InternalBuildCancelledException(org.gradle.tooling.internal.protocol.InternalBuildCancelledException) BuildCancelledException(org.gradle.api.BuildCancelledException) IncludedBuild(org.gradle.api.initialization.IncludedBuild) InternalBuildCancelledException(org.gradle.tooling.internal.protocol.InternalBuildCancelledException)

Example 13 with GradleInternal

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

the class SubscribableBuildActionRunner method run.

@Override
public void run(BuildAction action, BuildController buildController) {
    if (!(action instanceof SubscribableBuildAction)) {
        return;
    }
    GradleInternal gradle = buildController.getGradle();
    SubscribableBuildAction subscribableBuildAction = (SubscribableBuildAction) action;
    // register listeners that dispatch all progress via the registered BuildEventConsumer instance,
    // this allows to send progress events back to the DaemonClient (via short-cut)
    registerListenersForClientSubscriptions(subscribableBuildAction.getClientSubscriptions(), gradle);
    try {
        delegate.run(action, buildController);
    } finally {
        for (BuildOperationListener listener : listeners) {
            buildOperationService.removeListener(listener);
        }
    }
}
Also used : GradleInternal(org.gradle.api.internal.GradleInternal) BuildOperationListener(org.gradle.internal.progress.BuildOperationListener) SubscribableBuildAction(org.gradle.tooling.internal.provider.SubscribableBuildAction)

Example 14 with GradleInternal

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

the class GradleBuildController method doBuild.

private GradleInternal doBuild(final Callable<GradleInternal> build) {
    GradleInternal gradle = getGradle();
    BuildOperationExecutor buildOperationExecutor = gradle.getServices().get(BuildOperationExecutor.class);
    gradle.setBuildOperation(buildOperationExecutor.getCurrentOperation());
    try {
        // TODO:pm Move this to RunAsBuildOperationBuildActionRunner when BuildOperationWorkerRegistry scope is changed
        return workerLeaseService.withLocks(Collections.singleton(workerLeaseService.getWorkerLease()), build);
    } finally {
        gradle.setBuildOperation(null);
        state = State.Completed;
    }
}
Also used : GradleInternal(org.gradle.api.internal.GradleInternal) BuildOperationExecutor(org.gradle.internal.operations.BuildOperationExecutor)

Example 15 with GradleInternal

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

the class DefaultGradleLauncher method scheduleTasks.

@Override
public void scheduleTasks(final Iterable<String> taskPaths) {
    GradleInternal gradle = getConfiguredBuild();
    Set<String> allTasks = Sets.newLinkedHashSet(gradle.getStartParameter().getTaskNames());
    boolean added = allTasks.addAll(Lists.newArrayList(taskPaths));
    if (!added) {
        return;
    }
    gradle.getStartParameter().setTaskNames(allTasks);
    // Force back to configure so that task graph will get reevaluated
    stage = Stage.Configure;
    doBuildStages(Stage.TaskGraph);
}
Also used : GradleInternal(org.gradle.api.internal.GradleInternal)

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