use of org.gradle.internal.service.DefaultServiceRegistry in project gradle by gradle.
the class TestWorker method execute.
@Override
public void execute(final WorkerProcessContext workerProcessContext) {
Thread.currentThread().setName(WORK_THREAD_NAME);
LOGGER.info("{} started executing tests.", workerProcessContext.getDisplayName());
SecurityManager securityManager = System.getSecurityManager();
System.setProperty(WORKER_ID_SYS_PROPERTY, workerProcessContext.getWorkerId().toString());
DefaultServiceRegistry testServices = new TestFrameworkServiceRegistry(workerProcessContext);
startReceivingTests(workerProcessContext, testServices);
try {
try {
while (state != State.STOPPED) {
executeAndMaintainThreadName(runQueue.take());
}
} catch (InterruptedException e) {
throw UncheckedException.throwAsUncheckedException(e);
}
} finally {
LOGGER.info("{} finished executing tests.", workerProcessContext.getDisplayName());
// and clear out the run queue to unblock any running communication threads
synchronized (this) {
state = State.STOPPED;
runQueue.clear();
}
if (System.getSecurityManager() != securityManager) {
try {
// Reset security manager the tests seem to have installed
System.setSecurityManager(securityManager);
} catch (SecurityException e) {
LOGGER.warn("Unable to reset SecurityManager. Continuing anyway...", e);
}
}
testServices.close();
}
}
use of org.gradle.internal.service.DefaultServiceRegistry in project gradle by gradle.
the class DefaultDependencyManagementServices method create.
@Override
public DependencyResolutionServices create(FileResolver resolver, FileCollectionFactory fileCollectionFactory, DependencyMetaDataProvider dependencyMetaDataProvider, ProjectFinder projectFinder, DomainObjectContext domainObjectContext) {
DefaultServiceRegistry services = new DefaultServiceRegistry(parent);
services.add(FileResolver.class, resolver);
services.add(FileCollectionFactory.class, fileCollectionFactory);
services.add(DependencyMetaDataProvider.class, dependencyMetaDataProvider);
services.add(ProjectFinder.class, projectFinder);
services.add(DomainObjectContext.class, domainObjectContext);
services.addProvider(new ArtifactTransformResolutionGradleUserHomeServices());
services.addProvider(new DependencyResolutionScopeServices(domainObjectContext));
return services.get(DependencyResolutionServices.class);
}
Aggregations