Search in sources :

Example 1 with DeploymentRegistry

use of org.gradle.deployment.internal.DeploymentRegistry 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)

Example 2 with DeploymentRegistry

use of org.gradle.deployment.internal.DeploymentRegistry in project gradle by gradle.

the class PlayRun method registerOrFindDeploymentHandle.

private PlayApplicationDeploymentHandle registerOrFindDeploymentHandle(String deploymentId) {
    DeploymentRegistry deploymentRegistry = getDeploymentRegistry();
    PlayApplicationDeploymentHandle deploymentHandle = deploymentRegistry.get(PlayApplicationDeploymentHandle.class, deploymentId);
    if (deploymentHandle == null) {
        deploymentHandle = new PlayApplicationDeploymentHandle(deploymentId);
        deploymentRegistry.register(deploymentId, deploymentHandle);
    }
    return deploymentHandle;
}
Also used : DeploymentRegistry(org.gradle.deployment.internal.DeploymentRegistry) PlayApplicationDeploymentHandle(org.gradle.play.internal.run.PlayApplicationDeploymentHandle)

Aggregations

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