Search in sources :

Example 1 with ResolutionStrategyInternal

use of org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal 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 ResolutionStrategyInternal

use of org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal in project gradle by gradle.

the class DependencyGraphBuilder method resolve.

public void resolve(final ResolveContext resolveContext, final DependencyGraphVisitor modelVisitor, boolean includeSyntheticDependencies) {
    IdGenerator<Long> idGenerator = new LongIdGenerator();
    DefaultBuildableComponentResolveResult rootModule = new DefaultBuildableComponentResolveResult();
    moduleResolver.resolve(resolveContext, rootModule);
    int graphSize = estimateSize(resolveContext);
    ResolutionStrategyInternal resolutionStrategy = resolveContext.getResolutionStrategy();
    List<? extends DependencyMetadata> syntheticDependencies = includeSyntheticDependencies ? syntheticDependenciesOf(rootModule, resolveContext.getName()) : Collections.emptyList();
    final ResolveState resolveState = new ResolveState(idGenerator, rootModule, resolveContext.getName(), idResolver, metaDataResolver, edgeFilter, attributesSchema, moduleExclusions, componentSelectorConverter, attributesFactory, dependencySubstitutionApplicator, versionSelectorScheme, versionComparator, versionParser, moduleConflictHandler.getResolver(), graphSize, resolveContext.getResolutionStrategy().getConflictResolution(), syntheticDependencies, conflictTracker);
    Map<ModuleVersionIdentifier, ComponentIdentifier> componentIdentifierCache = Maps.newHashMapWithExpectedSize(graphSize / 2);
    traverseGraph(resolveState, componentIdentifierCache);
    validateGraph(resolveState, resolutionStrategy.isFailingOnDynamicVersions(), resolutionStrategy.isFailingOnChangingVersions());
    assembleResult(resolveState, modelVisitor);
}
Also used : ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) LongIdGenerator(org.gradle.internal.id.LongIdGenerator) DefaultBuildableComponentResolveResult(org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult) DefaultModuleComponentIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) ResolutionStrategyInternal(org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) BuildOperationConstraint(org.gradle.internal.operations.BuildOperationConstraint) ResolvedVersionConstraint(org.gradle.api.internal.artifacts.ResolvedVersionConstraint)

Example 3 with ResolutionStrategyInternal

use of org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal 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 4 with ResolutionStrategyInternal

use of org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal 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 ResolutionStrategyInternal

use of org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal 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

ResolutionStrategyInternal (org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal)7 ComponentResolvers (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentResolvers)4 ResolverProviderFactory (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ResolverProviderFactory)3 DependencyVerificationOverride (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.verification.DependencyVerificationOverride)2 BuildDependenciesOnlyVisitedArtifactSet (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.BuildDependenciesOnlyVisitedArtifactSet)2 DefaultResolvedArtifactsBuilder (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DefaultResolvedArtifactsBuilder)2 CompositeDependencyGraphVisitor (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.CompositeDependencyGraphVisitor)2 ResolutionFailureCollector (org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.ResolutionFailureCollector)2 ResolvedLocalComponentsResultGraphVisitor (org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResultGraphVisitor)2 ImmutableList (com.google.common.collect.ImmutableList)1 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)1 UnresolvedDependency (org.gradle.api.artifacts.UnresolvedDependency)1 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)1 ProjectComponentIdentifier (org.gradle.api.artifacts.component.ProjectComponentIdentifier)1 ResolvedComponentResult (org.gradle.api.artifacts.result.ResolvedComponentResult)1 ResolvedVersionConstraint (org.gradle.api.internal.artifacts.ResolvedVersionConstraint)1 ConfigurationInternal (org.gradle.api.internal.artifacts.configurations.ConfigurationInternal)1 ErrorHandlingArtifactResolver (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingArtifactResolver)1 DependencyArtifactsVisitor (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DependencyArtifactsVisitor)1 VisitedArtifactsResults (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.VisitedArtifactsResults)1