Search in sources :

Example 1 with SharedResource

use of org.gradle.internal.resources.SharedResource in project gradle by gradle.

the class AbstractTask method getSharedResources.

@Override
public List<ResourceLock> getSharedResources() {
    if (requiredServices == null) {
        return Collections.emptyList();
    }
    ImmutableList.Builder<ResourceLock> locks = ImmutableList.builder();
    BuildServiceRegistryInternal serviceRegistry = getServices().get(BuildServiceRegistryInternal.class);
    for (Provider<? extends BuildService<?>> service : requiredServices) {
        SharedResource resource = serviceRegistry.forService(service);
        if (resource.getMaxUsages() > 0) {
            locks.add(resource.getResourceLock());
        }
    }
    return locks.build();
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) BuildServiceRegistryInternal(org.gradle.api.services.internal.BuildServiceRegistryInternal) SharedResource(org.gradle.internal.resources.SharedResource) ResourceLock(org.gradle.internal.resources.ResourceLock)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 BuildServiceRegistryInternal (org.gradle.api.services.internal.BuildServiceRegistryInternal)1 ResourceLock (org.gradle.internal.resources.ResourceLock)1 SharedResource (org.gradle.internal.resources.SharedResource)1