use of org.gradle.initialization.SessionLifecycleListener 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();
}
}
Aggregations