Search in sources :

Example 1 with ComponentResolvers

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers in project gradle by gradle.

the class DefaultArtifactDependencyResolver method createResolvers.

private ComponentResolversChain createResolvers(ResolveContext resolveContext, List<? extends ResolutionAwareRepository> repositories, GlobalDependencyResolutionRules metadataHandler, ArtifactTypeRegistry artifactTypeRegistry) {
    List<ComponentResolvers> resolvers = Lists.newArrayList();
    for (ResolverProviderFactory factory : resolverFactories) {
        if (factory.canCreate(resolveContext)) {
            resolvers.add(factory.create(resolveContext));
        }
    }
    ResolutionStrategyInternal resolutionStrategy = resolveContext.getResolutionStrategy();
    resolvers.add(ivyFactory.create(resolutionStrategy, repositories, metadataHandler.getComponentMetadataProcessor()));
    return new ComponentResolversChain(resolvers, artifactTypeRegistry);
}
Also used : ComponentResolvers(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers) ResolverProviderFactory(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ResolverProviderFactory) ResolutionStrategyInternal(org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal)

Example 2 with ComponentResolvers

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers in project gradle by gradle.

the class DefaultArtifactDependencyResolver method createResolvers.

private ComponentResolversChain createResolvers(ResolveContext resolveContext, List<? extends ResolutionAwareRepository> repositories, GlobalDependencyResolutionRules metadataHandler, ArtifactTypeRegistry artifactTypeRegistry, AttributesSchema consumerSchema) {
    List<ComponentResolvers> resolvers = Lists.newArrayList();
    for (ResolverProviderFactory factory : resolverFactories) {
        factory.create(resolveContext, resolvers);
    }
    resolvers.add(projectDependencyResolver);
    ResolutionStrategyInternal resolutionStrategy = resolveContext.getResolutionStrategy();
    resolvers.add(ivyFactory.create(resolveContext.getName(), resolutionStrategy, repositories, metadataHandler.getComponentMetadataProcessorFactory(), resolveContext.getAttributes(), consumerSchema, attributesFactory, componentMetadataSupplierRuleExecutor));
    return new ComponentResolversChain(resolvers, artifactTypeRegistry, calculatedValueContainerFactory);
}
Also used : ComponentResolvers(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers) ResolverProviderFactory(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ResolverProviderFactory) ResolutionStrategyInternal(org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal)

Example 3 with ComponentResolvers

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers in project gradle by gradle.

the class DefaultArtifactDependencyResolver method resolve.

@Override
public void resolve(ResolveContext resolveContext, List<? extends ResolutionAwareRepository> repositories, GlobalDependencyResolutionRules metadataHandler, Spec<? super DependencyMetadata> edgeFilter, DependencyGraphVisitor graphVisitor, DependencyArtifactsVisitor artifactsVisitor, AttributesSchema attributesSchema, ImmutableModuleIdentifierFactory moduleIdentifierFactory, ModuleExclusions moduleExclusions) {
    LOGGER.debug("Resolving {}", resolveContext);
    ComponentResolvers resolvers = createResolvers(resolveContext, repositories, metadataHandler);
    DependencyGraphBuilder builder = createDependencyGraphBuilder(resolvers, resolveContext.getResolutionStrategy(), metadataHandler, edgeFilter, attributesSchema, moduleIdentifierFactory, moduleExclusions);
    ArtifactResolver artifactResolver = new ErrorHandlingArtifactResolver(new CacheLockingArtifactResolver(cacheLockingManager, resolvers.getArtifactResolver()));
    BuildOperationExecutor buildOperationExecutor = serviceRegistry.get(BuildOperationExecutor.class);
    DependencyGraphVisitor artifactsGraphVisitor = new ResolvedArtifactsGraphVisitor(artifactsVisitor, artifactResolver, attributesFactory, buildOperationExecutor, moduleExclusions);
    // Resolve the dependency graph
    builder.resolve(resolveContext, new CompositeDependencyGraphVisitor(graphVisitor, artifactsGraphVisitor));
}
Also used : DependencyGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphVisitor) CompositeDependencyGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.CompositeDependencyGraphVisitor) DependencyGraphBuilder(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder) ResolvedArtifactsGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvedArtifactsGraphVisitor) CacheLockingArtifactResolver(org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactResolver) CompositeDependencyGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.CompositeDependencyGraphVisitor) ErrorHandlingArtifactResolver(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingArtifactResolver) ComponentResolvers(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers) CacheLockingArtifactResolver(org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactResolver) ArtifactResolver(org.gradle.internal.resolve.resolver.ArtifactResolver) ErrorHandlingArtifactResolver(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingArtifactResolver) BuildOperationExecutor(org.gradle.internal.progress.BuildOperationExecutor)

Example 4 with ComponentResolvers

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers in project gradle by gradle.

the class DefaultArtifactDependencyResolver method createResolvers.

private ComponentResolversChain createResolvers(ResolveContext resolveContext, List<? extends ResolutionAwareRepository> repositories, GlobalDependencyResolutionRules metadataHandler) {
    List<ResolverProviderFactory> resolverFactories = allServices(ResolverProviderFactory.class);
    List<ComponentResolvers> resolvers = Lists.newArrayList();
    for (ResolverProviderFactory factory : resolverFactories) {
        if (factory.canCreate(resolveContext)) {
            resolvers.add(factory.create(resolveContext));
        }
    }
    ResolutionStrategyInternal resolutionStrategy = resolveContext.getResolutionStrategy();
    resolvers.add(ivyFactory.create(resolutionStrategy, repositories, metadataHandler.getComponentMetadataProcessor()));
    return new ComponentResolversChain(resolvers);
}
Also used : ComponentResolvers(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers) ResolverProviderFactory(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ResolverProviderFactory) ResolutionStrategyInternal(org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal)

Example 5 with ComponentResolvers

use of org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers in project gradle by gradle.

the class DefaultArtifactResolutionQuery method execute.

@Override
public ArtifactResolutionResult execute() {
    if (componentType == null) {
        throw new IllegalStateException("Must specify component type and artifacts to query.");
    }
    List<? extends ResolutionAwareRepository> repositories = repositoriesSupplier.get();
    ConfigurationInternal detachedConfiguration = configurationContainer.detachedConfiguration();
    ResolutionStrategyInternal resolutionStrategy = detachedConfiguration.getResolutionStrategy();
    ComponentResolvers componentResolvers = ivyFactory.create(detachedConfiguration.getName(), resolutionStrategy, repositories, metadataHandler.getComponentMetadataProcessorFactory(), ImmutableAttributes.EMPTY, null, attributesFactory, componentMetadataSupplierRuleExecutor);
    ComponentMetaDataResolver componentMetaDataResolver = componentResolvers.getComponentResolver();
    ArtifactResolver artifactResolver = new ErrorHandlingArtifactResolver(componentResolvers.getArtifactResolver());
    return createResult(componentMetaDataResolver, artifactResolver);
}
Also used : ComponentMetaDataResolver(org.gradle.internal.resolve.resolver.ComponentMetaDataResolver) ErrorHandlingArtifactResolver(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingArtifactResolver) ComponentResolvers(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers) ResolutionStrategyInternal(org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) ConfigurationInternal(org.gradle.api.internal.artifacts.configurations.ConfigurationInternal) ArtifactResolver(org.gradle.internal.resolve.resolver.ArtifactResolver) ErrorHandlingArtifactResolver(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingArtifactResolver)

Aggregations

ComponentResolvers (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers)5 ResolutionStrategyInternal (org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal)4 ResolverProviderFactory (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ResolverProviderFactory)3 ErrorHandlingArtifactResolver (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingArtifactResolver)2 ArtifactResolver (org.gradle.internal.resolve.resolver.ArtifactResolver)2 ConfigurationInternal (org.gradle.api.internal.artifacts.configurations.ConfigurationInternal)1 CacheLockingArtifactResolver (org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactResolver)1 ResolvedArtifactsGraphVisitor (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvedArtifactsGraphVisitor)1 CompositeDependencyGraphVisitor (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.CompositeDependencyGraphVisitor)1 DependencyGraphBuilder (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder)1 DependencyGraphVisitor (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphVisitor)1 BuildOperationExecutor (org.gradle.internal.progress.BuildOperationExecutor)1 ComponentMetaDataResolver (org.gradle.internal.resolve.resolver.ComponentMetaDataResolver)1