Search in sources :

Example 1 with ComponentMetadataProcessor

use of org.gradle.api.internal.artifacts.ComponentMetadataProcessor in project gradle by gradle.

the class ResolveIvyFactory method create.

public ComponentResolvers create(String resolveContextName, ResolutionStrategyInternal resolutionStrategy, Collection<? extends ResolutionAwareRepository> repositories, ComponentMetadataProcessorFactory metadataProcessor, AttributeContainer consumerAttributes, AttributesSchema attributesSchema, ImmutableAttributesFactory attributesFactory, ComponentMetadataSupplierRuleExecutor componentMetadataSupplierRuleExecutor) {
    if (repositories.isEmpty()) {
        return new NoRepositoriesResolver();
    }
    CachePolicy cachePolicy = resolutionStrategy.getCachePolicy();
    startParameterResolutionOverride.applyToCachePolicy(cachePolicy);
    UserResolverChain moduleResolver = new UserResolverChain(versionComparator, resolutionStrategy.getComponentSelection(), versionParser, consumerAttributes, attributesSchema, attributesFactory, metadataProcessor, componentMetadataSupplierRuleExecutor, cachePolicy, calculatedValueContainerFactory);
    ParentModuleLookupResolver parentModuleResolver = new ParentModuleLookupResolver(versionComparator, moduleIdentifierFactory, versionParser, consumerAttributes, attributesSchema, attributesFactory, metadataProcessor, componentMetadataSupplierRuleExecutor, cachePolicy, calculatedValueContainerFactory);
    for (ResolutionAwareRepository repository : repositories) {
        ConfiguredModuleComponentRepository baseRepository = repository.createResolver();
        baseRepository.setComponentResolvers(parentModuleResolver);
        Instantiator instantiator = baseRepository.getComponentMetadataInstantiator();
        MetadataResolutionContext metadataResolutionContext = new DefaultMetadataResolutionContext(cachePolicy, instantiator);
        ComponentMetadataProcessor componentMetadataProcessor = metadataProcessor.createComponentMetadataProcessor(metadataResolutionContext);
        ModuleComponentRepository moduleComponentRepository = baseRepository;
        if (baseRepository.isLocal()) {
            moduleComponentRepository = new CachingModuleComponentRepository(moduleComponentRepository, cacheProvider.getInMemoryOnlyCaches(), cachePolicy, timeProvider, componentMetadataProcessor, ChangingValueDependencyResolutionListener.NO_OP);
            moduleComponentRepository = new LocalModuleComponentRepository(moduleComponentRepository);
        } else {
            moduleComponentRepository = startParameterResolutionOverride.overrideModuleVersionRepository(moduleComponentRepository);
            moduleComponentRepository = new CachingModuleComponentRepository(moduleComponentRepository, cacheProvider.getPersistentCaches(), cachePolicy, timeProvider, componentMetadataProcessor, listener);
        }
        moduleComponentRepository = cacheProvider.getResolvedArtifactCaches().provideResolvedArtifactCache(moduleComponentRepository, resolutionStrategy.isDependencyVerificationEnabled());
        if (baseRepository.isDynamicResolveMode()) {
            moduleComponentRepository = new IvyDynamicResolveModuleComponentRepository(moduleComponentRepository);
        }
        moduleComponentRepository = new ErrorHandlingModuleComponentRepository(moduleComponentRepository, repositoryBlacklister);
        moduleComponentRepository = filterRepository(repository, moduleComponentRepository, resolveContextName, consumerAttributes);
        moduleComponentRepository = dependencyVerificationOverride.overrideDependencyVerification(moduleComponentRepository, resolveContextName, resolutionStrategy);
        moduleResolver.add(moduleComponentRepository);
        parentModuleResolver.add(moduleComponentRepository);
    }
    return moduleResolver;
}
Also used : ResolutionAwareRepository(org.gradle.api.internal.artifacts.repositories.ResolutionAwareRepository) MetadataResolutionContext(org.gradle.api.internal.artifacts.MetadataResolutionContext) Instantiator(org.gradle.internal.reflect.Instantiator) ComponentMetadataProcessor(org.gradle.api.internal.artifacts.ComponentMetadataProcessor) CachePolicy(org.gradle.api.internal.artifacts.configurations.dynamicversion.CachePolicy)

Aggregations

ComponentMetadataProcessor (org.gradle.api.internal.artifacts.ComponentMetadataProcessor)1 MetadataResolutionContext (org.gradle.api.internal.artifacts.MetadataResolutionContext)1 CachePolicy (org.gradle.api.internal.artifacts.configurations.dynamicversion.CachePolicy)1 ResolutionAwareRepository (org.gradle.api.internal.artifacts.repositories.ResolutionAwareRepository)1 Instantiator (org.gradle.internal.reflect.Instantiator)1