use of org.gradle.internal.service.ServiceRegistry in project gradle by gradle.
the class ShutdownCoordinator method stop.
public void stop() {
ServiceRegistry clientServices = clientFactory.createStopDaemonServices(outputEventListener, new DaemonParameters(new BuildLayoutParameters()));
DaemonStopClient client = clientServices.get(DaemonStopClient.class);
client.gracefulStop(daemons);
}
use of org.gradle.internal.service.ServiceRegistry in project gradle by gradle.
the class DefaultGradleLauncherFactory method createChildInstance.
private GradleLauncher createChildInstance(StartParameter startParameter, GradleLauncher parent, BuildSessionScopeServices buildSessionScopeServices, List<?> servicesToStop) {
ServiceRegistry services = parent.getGradle().getServices();
BuildRequestMetaData requestMetaData = new DefaultBuildRequestMetaData(services.get(BuildClientMetaData.class));
BuildCancellationToken cancellationToken = services.get(BuildCancellationToken.class);
BuildEventConsumer buildEventConsumer = services.get(BuildEventConsumer.class);
return doNewInstance(startParameter, parent, cancellationToken, requestMetaData, buildEventConsumer, buildSessionScopeServices, servicesToStop);
}
use of org.gradle.internal.service.ServiceRegistry in project gradle by gradle.
the class TestUtility method createMockProject.
/**
* Creates a mock project with the specified properties.
*
* Note: depth is 0 for a root project. 1 for a root project's subproject, etc.
*/
public static Project createMockProject(JUnit4Mockery context, final String name, final String buildFilePath, final int depth, Project[] subProjectArray, Task[] tasks, String[] defaultTasks) {
final ProjectInternal project = context.mock(ProjectInternal.class, "[project]_" + name + '_' + uniqueNameCounter++);
final ServiceRegistry services = ServiceRegistryBuilder.builder().provider(new Object() {
ProjectTaskLister createTaskLister() {
return new DefaultProjectTaskLister();
}
}).build();
context.checking(new Expectations() {
{
allowing(project).getName();
will(returnValue(name));
allowing(project).getDescription();
will(returnValue(null));
allowing(project).getBuildFile();
will(returnValue(new File(buildFilePath)));
allowing(project).getDepth();
will(returnValue(depth));
allowing(project).getServices();
will(returnValue(services));
}
});
attachSubProjects(context, project, subProjectArray);
attachTasks(context, project, tasks);
assignDefaultTasks(context, project, defaultTasks);
return project;
}
use of org.gradle.internal.service.ServiceRegistry in project gradle by gradle.
the class ProjectBuilderImpl method createProject.
public Project createProject(String name, File inputProjectDir, File gradleUserHomeDir) {
File projectDir = prepareProjectDir(inputProjectDir);
final File homeDir = new File(projectDir, "gradleHome");
StartParameter startParameter = new StartParameter();
File userHomeDir = gradleUserHomeDir == null ? new File(projectDir, "userHome") : FileUtils.canonicalize(gradleUserHomeDir);
startParameter.setGradleUserHomeDir(userHomeDir);
NativeServices.initialize(userHomeDir);
ServiceRegistry topLevelRegistry = new TestBuildScopeServices(getUserHomeServices(userHomeDir), startParameter, homeDir);
GradleInternal gradle = CLASS_GENERATOR.newInstance(DefaultGradle.class, null, startParameter, topLevelRegistry.get(ServiceRegistryFactory.class));
DefaultProjectDescriptor projectDescriptor = new DefaultProjectDescriptor(null, name, projectDir, new DefaultProjectDescriptorRegistry(), topLevelRegistry.get(FileResolver.class));
ClassLoaderScope baseScope = gradle.getClassLoaderScope();
ClassLoaderScope rootProjectScope = baseScope.createChild("root-project");
ProjectInternal project = topLevelRegistry.get(IProjectFactory.class).createProject(projectDescriptor, null, gradle, rootProjectScope, baseScope);
gradle.setRootProject(project);
gradle.setDefaultProject(project);
return project;
}
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();
ServiceRegistry clientServices = clientSharedServices.get(DaemonClientFactory.class).createStopDaemonServices(loggingServices.get(OutputEventListener.class), daemonParameters);
ReportDaemonStatusClient statusClient = clientServices.get(ReportDaemonStatusClient.class);
return new ReportDaemonStatusAction(statusClient);
}
Aggregations