Search in sources :

Example 16 with DefaultServiceRegistry

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();
    }
}
Also used : DefaultServiceRegistry(org.gradle.internal.service.DefaultServiceRegistry)

Example 17 with DefaultServiceRegistry

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);
}
Also used : DefaultServiceRegistry(org.gradle.internal.service.DefaultServiceRegistry) DependencyVerificationOverride(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.verification.DependencyVerificationOverride)

Aggregations

DefaultServiceRegistry (org.gradle.internal.service.DefaultServiceRegistry)17 RepositoryResourceAccessor (org.gradle.api.artifacts.repositories.RepositoryResourceAccessor)3 ExternalRepositoryResourceAccessor (org.gradle.api.internal.artifacts.repositories.resolver.ExternalRepositoryResourceAccessor)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ObjectConnection (org.gradle.internal.remote.ObjectConnection)2 File (java.io.File)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 DependencyInjectingInstantiator (org.gradle.api.internal.DependencyInjectingInstantiator)1 DomainObjectContext (org.gradle.api.internal.DomainObjectContext)1 DependencyManagementServices (org.gradle.api.internal.artifacts.DependencyManagementServices)1 DependencyResolutionServices (org.gradle.api.internal.artifacts.DependencyResolutionServices)1 UnknownProjectFinder (org.gradle.api.internal.artifacts.dsl.dependencies.UnknownProjectFinder)1 DependencyVerificationOverride (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.verification.DependencyVerificationOverride)1 OutputPropertyRoleAnnotationHandler (org.gradle.api.internal.tasks.properties.annotations.OutputPropertyRoleAnnotationHandler)1 PropertyAnnotationHandler (org.gradle.api.internal.tasks.properties.annotations.PropertyAnnotationHandler)1 DefaultCrossBuildInMemoryCacheFactory (org.gradle.cache.internal.DefaultCrossBuildInMemoryCacheFactory)1 UncheckedException (org.gradle.internal.UncheckedException)1 DefaultExecutorFactory (org.gradle.internal.concurrent.DefaultExecutorFactory)1 DefaultListenerManager (org.gradle.internal.event.DefaultListenerManager)1 ExtensibleDynamicObject (org.gradle.internal.extensibility.ExtensibleDynamicObject)1