Search in sources :

Example 1 with GlobalScopeFileTimeStampInspector

use of org.gradle.api.internal.changedetection.state.GlobalScopeFileTimeStampInspector in project gradle by gradle.

the class DefaultGradleLauncherFactory method newInstance.

@Override
public GradleLauncher newInstance(StartParameter startParameter, BuildRequestContext requestContext, ServiceRegistry parentRegistry) {
    // This should only be used for top-level builds
    if (rootBuild != null) {
        throw new IllegalStateException("Cannot have a current build");
    }
    if (!(parentRegistry instanceof BuildSessionScopeServices)) {
        throw new IllegalArgumentException("Service registry must be of build session scope");
    }
    BuildSessionScopeServices sessionScopeServices = (BuildSessionScopeServices) parentRegistry;
    DefaultGradleLauncher launcher = doNewInstance(startParameter, null, requestContext.getCancellationToken(), requestContext, requestContext.getEventConsumer(), sessionScopeServices, ImmutableList.of(new Stoppable() {

        @Override
        public void stop() {
            rootBuild = null;
        }
    }));
    rootBuild = launcher;
    DeploymentRegistry deploymentRegistry = parentRegistry.get(DeploymentRegistry.class);
    deploymentRegistry.onNewBuild(launcher.getGradle());
    GlobalScopeFileTimeStampInspector timeStampInspector = sessionScopeServices.get(GlobalScopeFileTimeStampInspector.class);
    launcher.addListener(timeStampInspector);
    return launcher;
}
Also used : GlobalScopeFileTimeStampInspector(org.gradle.api.internal.changedetection.state.GlobalScopeFileTimeStampInspector) DeploymentRegistry(org.gradle.deployment.internal.DeploymentRegistry) Stoppable(org.gradle.internal.concurrent.Stoppable) BuildSessionScopeServices(org.gradle.internal.service.scopes.BuildSessionScopeServices)

Aggregations

GlobalScopeFileTimeStampInspector (org.gradle.api.internal.changedetection.state.GlobalScopeFileTimeStampInspector)1 DeploymentRegistry (org.gradle.deployment.internal.DeploymentRegistry)1 Stoppable (org.gradle.internal.concurrent.Stoppable)1 BuildSessionScopeServices (org.gradle.internal.service.scopes.BuildSessionScopeServices)1