Search in sources :

Example 1 with ExternalResourceResolver

use of org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver in project gradle by gradle.

the class ResolveIvyFactory method create.

public ComponentResolvers create(ResolutionStrategyInternal resolutionStrategy, Collection<? extends ResolutionAwareRepository> repositories, ComponentMetadataProcessor metadataProcessor) {
    if (repositories.isEmpty()) {
        return new NoRepositoriesResolver();
    }
    ResolutionRules resolutionRules = resolutionStrategy.getResolutionRules();
    CachePolicy cachePolicy = resolutionStrategy.getCachePolicy();
    startParameterResolutionOverride.addResolutionRules(resolutionRules);
    UserResolverChain moduleResolver = new UserResolverChain(versionSelectorScheme, versionComparator, resolutionStrategy.getComponentSelection(), moduleIdentifierFactory);
    ParentModuleLookupResolver parentModuleResolver = new ParentModuleLookupResolver(versionSelectorScheme, versionComparator, moduleIdentifierFactory);
    for (ResolutionAwareRepository repository : repositories) {
        ConfiguredModuleComponentRepository baseRepository = repository.createResolver();
        if (baseRepository instanceof ExternalResourceResolver) {
            ((ExternalResourceResolver) baseRepository).setComponentResolvers(parentModuleResolver);
        }
        ModuleComponentRepository moduleComponentRepository = baseRepository;
        if (baseRepository.isLocal()) {
            moduleComponentRepository = new CachingModuleComponentRepository(moduleComponentRepository, cacheProvider.getInMemoryCaches(), cachePolicy, timeProvider, metadataProcessor, moduleIdentifierFactory);
            moduleComponentRepository = new LocalModuleComponentRepository(moduleComponentRepository, metadataProcessor);
        } else {
            moduleComponentRepository = startParameterResolutionOverride.overrideModuleVersionRepository(moduleComponentRepository);
            moduleComponentRepository = new CachingModuleComponentRepository(moduleComponentRepository, cacheProvider.getCaches(), cachePolicy, timeProvider, metadataProcessor, moduleIdentifierFactory);
        }
        moduleComponentRepository = cacheProvider.getResolvedArtifactCaches().provideResolvedArtifactCache(moduleComponentRepository);
        if (baseRepository.isDynamicResolveMode()) {
            moduleComponentRepository = new IvyDynamicResolveModuleComponentRepository(moduleComponentRepository);
        }
        moduleComponentRepository = new ErrorHandlingModuleComponentRepository(moduleComponentRepository, repositoryBlacklister);
        moduleResolver.add(moduleComponentRepository);
        parentModuleResolver.add(moduleComponentRepository);
    }
    return moduleResolver;
}
Also used : ResolutionAwareRepository(org.gradle.api.internal.artifacts.repositories.ResolutionAwareRepository) ResolutionRules(org.gradle.api.artifacts.cache.ResolutionRules) CachePolicy(org.gradle.api.internal.artifacts.configurations.dynamicversion.CachePolicy) ExternalResourceResolver(org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver)

Aggregations

ResolutionRules (org.gradle.api.artifacts.cache.ResolutionRules)1 CachePolicy (org.gradle.api.internal.artifacts.configurations.dynamicversion.CachePolicy)1 ResolutionAwareRepository (org.gradle.api.internal.artifacts.repositories.ResolutionAwareRepository)1 ExternalResourceResolver (org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver)1