Search in sources :

Example 16 with ServiceRegistry

use of org.gradle.internal.service.ServiceRegistry in project gradle by gradle.

the class BuildActionsFactory method showDaemonStatus.

private Runnable showDaemonStatus(DaemonParameters daemonParameters, ServiceRegistry loggingServices) {
    ServiceRegistry clientSharedServices = createGlobalClientServices(false);
    ServiceRegistry clientServices = clientSharedServices.get(DaemonClientFactory.class).createStopDaemonServices(loggingServices.get(OutputEventListener.class), daemonParameters);
    ReportDaemonStatusClient statusClient = clientServices.get(ReportDaemonStatusClient.class);
    return new ReportDaemonStatusAction(statusClient);
}
Also used : ReportDaemonStatusClient(org.gradle.launcher.daemon.client.ReportDaemonStatusClient) DaemonClientFactory(org.gradle.launcher.daemon.client.DaemonClientFactory) ServiceRegistry(org.gradle.internal.service.ServiceRegistry) GradleUserHomeScopeServiceRegistry(org.gradle.internal.service.scopes.GradleUserHomeScopeServiceRegistry) OutputEventListener(org.gradle.internal.logging.events.OutputEventListener)

Example 17 with ServiceRegistry

use of org.gradle.internal.service.ServiceRegistry in project gradle by gradle.

the class BuildActionsFactory method runBuildWithDaemon.

private Runnable runBuildWithDaemon(StartParameterInternal startParameter, DaemonParameters daemonParameters, ServiceRegistry loggingServices) {
    // Create a client that will match based on the daemon startup parameters.
    ServiceRegistry clientSharedServices = createGlobalClientServices(true);
    ServiceRegistry clientServices = clientSharedServices.get(DaemonClientFactory.class).createBuildClientServices(loggingServices.get(OutputEventListener.class), daemonParameters, System.in);
    DaemonClient client = clientServices.get(DaemonClient.class);
    return runBuildAndCloseServices(startParameter, daemonParameters, client, clientSharedServices, clientServices);
}
Also used : DaemonClient(org.gradle.launcher.daemon.client.DaemonClient) DaemonClientFactory(org.gradle.launcher.daemon.client.DaemonClientFactory) ServiceRegistry(org.gradle.internal.service.ServiceRegistry) GradleUserHomeScopeServiceRegistry(org.gradle.internal.service.scopes.GradleUserHomeScopeServiceRegistry) OutputEventListener(org.gradle.internal.logging.events.OutputEventListener)

Example 18 with ServiceRegistry

use of org.gradle.internal.service.ServiceRegistry in project gradle by gradle.

the class BuildActionsFactory method stopAllDaemons.

private Runnable stopAllDaemons(DaemonParameters daemonParameters, ServiceRegistry loggingServices) {
    ServiceRegistry clientSharedServices = createGlobalClientServices(false);
    ServiceRegistry clientServices = clientSharedServices.get(DaemonClientFactory.class).createStopDaemonServices(loggingServices.get(OutputEventListener.class), daemonParameters);
    DaemonStopClient stopClient = clientServices.get(DaemonStopClient.class);
    return new StopDaemonAction(stopClient);
}
Also used : DaemonClientFactory(org.gradle.launcher.daemon.client.DaemonClientFactory) ServiceRegistry(org.gradle.internal.service.ServiceRegistry) GradleUserHomeScopeServiceRegistry(org.gradle.internal.service.scopes.GradleUserHomeScopeServiceRegistry) OutputEventListener(org.gradle.internal.logging.events.OutputEventListener) DaemonStopClient(org.gradle.launcher.daemon.client.DaemonStopClient)

Example 19 with ServiceRegistry

use of org.gradle.internal.service.ServiceRegistry in project gradle by gradle.

the class ConnectionScopeServices method createShutdownCoordinator.

ShutdownCoordinator createShutdownCoordinator(ListenerManager listenerManager, DaemonClientFactory daemonClientFactory, OutputEventListener outputEventListener) {
    ServiceRegistry clientServices = daemonClientFactory.createStopDaemonServices(outputEventListener, new DaemonParameters(new BuildLayoutParameters()));
    DaemonStopClient client = clientServices.get(DaemonStopClient.class);
    ShutdownCoordinator shutdownCoordinator = new ShutdownCoordinator(client);
    listenerManager.addListener(shutdownCoordinator);
    return shutdownCoordinator;
}
Also used : LoggingServiceRegistry(org.gradle.internal.logging.services.LoggingServiceRegistry) ServiceRegistry(org.gradle.internal.service.ServiceRegistry) BuildLayoutParameters(org.gradle.initialization.BuildLayoutParameters) DaemonParameters(org.gradle.launcher.daemon.configuration.DaemonParameters) DaemonStopClient(org.gradle.launcher.daemon.client.DaemonStopClient)

Example 20 with ServiceRegistry

use of org.gradle.internal.service.ServiceRegistry in project gradle by gradle.

the class ServicesSetupBuildActionExecuter method execute.

@Override
public Object execute(BuildAction action, BuildRequestContext requestContext, BuildActionParameters actionParameters, ServiceRegistry contextServices) {
    StartParameter startParameter = action.getStartParameter();
    final ServiceRegistry userHomeServices = userHomeServiceRegistry.getServicesFor(startParameter.getGradleUserHomeDir());
    CrossBuildSessionScopeServices crossBuildSessionScopeServices = new CrossBuildSessionScopeServices(contextServices, startParameter);
    try {
        ServiceRegistry buildSessionScopeServices = new BuildSessionScopeServices(userHomeServices, crossBuildSessionScopeServices, startParameter, requestContext, actionParameters.getInjectedPluginClasspath());
        try {
            SessionLifecycleListener sessionLifecycleListener = buildSessionScopeServices.get(ListenerManager.class).getBroadcaster(SessionLifecycleListener.class);
            try {
                sessionLifecycleListener.afterStart();
                return delegate.execute(action, requestContext, actionParameters, buildSessionScopeServices);
            } finally {
                sessionLifecycleListener.beforeComplete();
            }
        } finally {
            CompositeStoppable.stoppable(buildSessionScopeServices).stop();
        }
    } finally {
        new CompositeStoppable().add(new Stoppable() {

            @Override
            public void stop() {
                userHomeServiceRegistry.release(userHomeServices);
            }
        }, crossBuildSessionScopeServices).stop();
    }
}
Also used : StartParameter(org.gradle.StartParameter) CrossBuildSessionScopeServices(org.gradle.internal.service.scopes.CrossBuildSessionScopeServices) SessionLifecycleListener(org.gradle.initialization.SessionLifecycleListener) CompositeStoppable(org.gradle.internal.concurrent.CompositeStoppable) Stoppable(org.gradle.internal.concurrent.Stoppable) ServiceRegistry(org.gradle.internal.service.ServiceRegistry) GradleUserHomeScopeServiceRegistry(org.gradle.internal.service.scopes.GradleUserHomeScopeServiceRegistry) BuildSessionScopeServices(org.gradle.internal.service.scopes.BuildSessionScopeServices) CrossBuildSessionScopeServices(org.gradle.internal.service.scopes.CrossBuildSessionScopeServices) CompositeStoppable(org.gradle.internal.concurrent.CompositeStoppable) ListenerManager(org.gradle.internal.event.ListenerManager)

Aggregations

ServiceRegistry (org.gradle.internal.service.ServiceRegistry)20 GradleUserHomeScopeServiceRegistry (org.gradle.internal.service.scopes.GradleUserHomeScopeServiceRegistry)9 OutputEventListener (org.gradle.internal.logging.events.OutputEventListener)7 LoggingServiceRegistry (org.gradle.internal.logging.services.LoggingServiceRegistry)6 DaemonClientFactory (org.gradle.launcher.daemon.client.DaemonClientFactory)6 DaemonClient (org.gradle.launcher.daemon.client.DaemonClient)5 File (java.io.File)4 ProjectInternal (org.gradle.api.internal.project.ProjectInternal)3 DaemonStopClient (org.gradle.launcher.daemon.client.DaemonStopClient)3 StartParameter (org.gradle.StartParameter)2 BuildLayoutParameters (org.gradle.initialization.BuildLayoutParameters)2 LoggingManagerInternal (org.gradle.internal.logging.LoggingManagerInternal)2 ObjectConnection (org.gradle.internal.remote.ObjectConnection)2 BuildSessionScopeServices (org.gradle.internal.service.scopes.BuildSessionScopeServices)2 CrossBuildSessionScopeServices (org.gradle.internal.service.scopes.CrossBuildSessionScopeServices)2 DaemonParameters (org.gradle.launcher.daemon.configuration.DaemonParameters)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 GradleInternal (org.gradle.api.internal.GradleInternal)1