use of org.gradle.api.artifacts.cache.ResolutionRules 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;
}
Aggregations