Search in sources :

Example 1 with ResolvedLocalComponentsResultGraphVisitor

use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResultGraphVisitor in project gradle by gradle.

the class ShortCircuitEmptyConfigurationResolver method emptyGraph.

private void emptyGraph(ConfigurationInternal configuration, ResolverResults results) {
    Module module = configuration.getModule();
    ModuleVersionIdentifier id = moduleIdentifierFactory.moduleWithVersion(module);
    ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(module);
    ResolutionResult emptyResult = DefaultResolutionResultBuilder.empty(id, componentIdentifier);
    ResolvedLocalComponentsResult emptyProjectResult = new ResolvedLocalComponentsResultGraphVisitor(thisBuild.getCurrentBuild());
    results.graphResolved(emptyResult, emptyProjectResult, new EmptyResults());
}
Also used : ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) ResolutionResult(org.gradle.api.artifacts.result.ResolutionResult) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) Module(org.gradle.api.internal.artifacts.Module) ResolvedLocalComponentsResult(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResult) ResolvedLocalComponentsResultGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResultGraphVisitor)

Example 2 with ResolvedLocalComponentsResultGraphVisitor

use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResultGraphVisitor in project gradle by gradle.

the class DefaultConfigurationResolver method resolveBuildDependencies.

@Override
public void resolveBuildDependencies(ConfigurationInternal configuration, ResolverResults result) {
    ResolutionStrategyInternal resolutionStrategy = configuration.getResolutionStrategy();
    ResolutionFailureCollector failureCollector = new ResolutionFailureCollector(componentSelectorConverter);
    InMemoryResolutionResultBuilder resolutionResultBuilder = new InMemoryResolutionResultBuilder();
    ResolvedLocalComponentsResultGraphVisitor localComponentsVisitor = new ResolvedLocalComponentsResultGraphVisitor(currentBuild);
    CompositeDependencyGraphVisitor graphVisitor = new CompositeDependencyGraphVisitor(failureCollector, resolutionResultBuilder, localComponentsVisitor);
    DefaultResolvedArtifactsBuilder artifactsVisitor = new DefaultResolvedArtifactsBuilder(buildProjectDependencies, resolutionStrategy.getSortOrder());
    resolver.resolve(configuration, ImmutableList.of(), metadataHandler, IS_LOCAL_EDGE, graphVisitor, artifactsVisitor, attributesSchema, artifactTypeRegistry, false);
    result.graphResolved(resolutionResultBuilder.getResolutionResult(), localComponentsVisitor, new BuildDependenciesOnlyVisitedArtifactSet(failureCollector.complete(Collections.emptySet()), artifactsVisitor.complete(), artifactTransforms, configuration.getDependenciesResolver()));
}
Also used : DefaultResolvedArtifactsBuilder(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DefaultResolvedArtifactsBuilder) CompositeDependencyGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.CompositeDependencyGraphVisitor) ResolutionFailureCollector(org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.ResolutionFailureCollector) BuildDependenciesOnlyVisitedArtifactSet(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.BuildDependenciesOnlyVisitedArtifactSet) ResolutionStrategyInternal(org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) ResolvedLocalComponentsResultGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResultGraphVisitor) DependencyVerificationOverride(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.verification.DependencyVerificationOverride)

Example 3 with ResolvedLocalComponentsResultGraphVisitor

use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResultGraphVisitor in project gradle by gradle.

the class DefaultConfigurationResolver method resolveGraph.

@Override
public void resolveGraph(ConfigurationInternal configuration, ResolverResults results) {
    List<ResolutionAwareRepository> resolutionAwareRepositories = getRepositories();
    StoreSet stores = storeFactory.createStoreSet();
    BinaryStore oldModelStore = stores.nextBinaryStore();
    Store<TransientConfigurationResults> oldModelCache = stores.oldModelCache();
    TransientConfigurationResultsBuilder oldTransientModelBuilder = new TransientConfigurationResultsBuilder(oldModelStore, oldModelCache, moduleIdentifierFactory, buildOperationExecutor);
    DefaultResolvedConfigurationBuilder oldModelBuilder = new DefaultResolvedConfigurationBuilder(oldTransientModelBuilder);
    ResolvedConfigurationDependencyGraphVisitor oldModelVisitor = new ResolvedConfigurationDependencyGraphVisitor(oldModelBuilder);
    BinaryStore newModelStore = stores.nextBinaryStore();
    Store<ResolvedComponentResult> newModelCache = stores.newModelCache();
    StreamingResolutionResultBuilder newModelBuilder = new StreamingResolutionResultBuilder(newModelStore, newModelCache, moduleIdentifierFactory, attributeContainerSerializer, attributeDesugaring, componentSelectionDescriptorFactory);
    ResolvedLocalComponentsResultGraphVisitor localComponentsVisitor = new ResolvedLocalComponentsResultGraphVisitor(currentBuild);
    ResolutionStrategyInternal resolutionStrategy = configuration.getResolutionStrategy();
    DefaultResolvedArtifactsBuilder artifactsBuilder = new DefaultResolvedArtifactsBuilder(buildProjectDependencies, resolutionStrategy.getSortOrder());
    FileDependencyCollectingGraphVisitor fileDependencyVisitor = new FileDependencyCollectingGraphVisitor();
    ResolutionFailureCollector failureCollector = new ResolutionFailureCollector(componentSelectorConverter);
    DependencyGraphVisitor graphVisitor = new CompositeDependencyGraphVisitor(newModelBuilder, localComponentsVisitor, failureCollector);
    ImmutableList.Builder<DependencyArtifactsVisitor> visitors = new ImmutableList.Builder<>();
    visitors.add(oldModelVisitor);
    visitors.add(fileDependencyVisitor);
    visitors.add(artifactsBuilder);
    if (resolutionStrategy.getConflictResolution() == ConflictResolution.strict) {
        ProjectComponentIdentifier projectId = configuration.getModule().getProjectId();
        // projectId is null for DefaultModule used in settings
        String projectPath = projectId != null ? projectId.getProjectPath() : "";
        visitors.add(new FailOnVersionConflictArtifactsVisitor(projectPath, configuration.getName()));
    }
    DependencyLockingArtifactVisitor lockingVisitor = null;
    if (resolutionStrategy.isDependencyLockingEnabled()) {
        lockingVisitor = new DependencyLockingArtifactVisitor(configuration.getName(), resolutionStrategy.getDependencyLockingProvider());
        visitors.add(lockingVisitor);
    } else {
        resolutionStrategy.confirmUnlockedConfigurationResolved(configuration.getName());
    }
    ImmutableList<DependencyArtifactsVisitor> allVisitors = visitors.build();
    CompositeDependencyArtifactsVisitor artifactsVisitor = new CompositeDependencyArtifactsVisitor(allVisitors);
    resolver.resolve(configuration, resolutionAwareRepositories, metadataHandler, Specs.satisfyAll(), graphVisitor, artifactsVisitor, attributesSchema, artifactTypeRegistry, true);
    VisitedArtifactsResults artifactsResults = artifactsBuilder.complete();
    VisitedFileDependencyResults fileDependencyResults = fileDependencyVisitor.complete();
    ResolvedGraphResults graphResults = oldModelBuilder.complete();
    // Append to failures for locking and fail on version conflict
    Set<UnresolvedDependency> extraFailures = lockingVisitor == null ? Collections.emptySet() : lockingVisitor.collectLockingFailures();
    Set<UnresolvedDependency> failures = failureCollector.complete(extraFailures);
    results.graphResolved(newModelBuilder.complete(extraFailures), localComponentsVisitor, new BuildDependenciesOnlyVisitedArtifactSet(failures, artifactsResults, artifactTransforms, configuration.getDependenciesResolver()));
    results.retainState(new ArtifactResolveState(graphResults, artifactsResults, fileDependencyResults, failures, oldTransientModelBuilder));
    if (!results.hasError() && failures.isEmpty()) {
        artifactsVisitor.complete();
    }
}
Also used : TransientConfigurationResultsBuilder(org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientConfigurationResultsBuilder) ResolvedConfigurationDependencyGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.ResolvedConfigurationDependencyGraphVisitor) ResolutionAwareRepository(org.gradle.api.internal.artifacts.repositories.ResolutionAwareRepository) StreamingResolutionResultBuilder(org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder) ImmutableList(com.google.common.collect.ImmutableList) DefaultResolvedArtifactsBuilder(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DefaultResolvedArtifactsBuilder) StreamingResolutionResultBuilder(org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder) TransientConfigurationResultsBuilder(org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientConfigurationResultsBuilder) DefaultResolvedConfigurationBuilder(org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.DefaultResolvedConfigurationBuilder) CompositeDependencyGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.CompositeDependencyGraphVisitor) CompositeDependencyArtifactsVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.CompositeDependencyArtifactsVisitor) DefaultResolvedArtifactsBuilder(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DefaultResolvedArtifactsBuilder) DependencyGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphVisitor) CompositeDependencyGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.CompositeDependencyGraphVisitor) ResolvedConfigurationDependencyGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.ResolvedConfigurationDependencyGraphVisitor) CompositeDependencyArtifactsVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.CompositeDependencyArtifactsVisitor) DependencyArtifactsVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DependencyArtifactsVisitor) StoreSet(org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.StoreSet) FileDependencyCollectingGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.FileDependencyCollectingGraphVisitor) BinaryStore(org.gradle.cache.internal.BinaryStore) VisitedFileDependencyResults(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.VisitedFileDependencyResults) ResolvedGraphResults(org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.ResolvedGraphResults) FailOnVersionConflictArtifactsVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.conflicts.FailOnVersionConflictArtifactsVisitor) ResolvedLocalComponentsResultGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResultGraphVisitor) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) UnresolvedDependency(org.gradle.api.artifacts.UnresolvedDependency) VisitedArtifactsResults(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.VisitedArtifactsResults) DefaultResolvedConfigurationBuilder(org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.DefaultResolvedConfigurationBuilder) ResolutionFailureCollector(org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.ResolutionFailureCollector) BuildDependenciesOnlyVisitedArtifactSet(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.BuildDependenciesOnlyVisitedArtifactSet) TransientConfigurationResults(org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientConfigurationResults) DependencyLockingArtifactVisitor(org.gradle.internal.locking.DependencyLockingArtifactVisitor) ResolvedComponentResult(org.gradle.api.artifacts.result.ResolvedComponentResult) ResolutionStrategyInternal(org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal) DependencyVerificationOverride(org.gradle.api.internal.artifacts.ivyservice.ivyresolve.verification.DependencyVerificationOverride)

Example 4 with ResolvedLocalComponentsResultGraphVisitor

use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResultGraphVisitor in project gradle by gradle.

the class ShortCircuitEmptyConfigurationResolver method emptyGraph.

private void emptyGraph(ConfigurationInternal configuration, ResolverResults results, boolean verifyLocking) {
    if (verifyLocking && configuration.getResolutionStrategy().isDependencyLockingEnabled()) {
        DependencyLockingProvider dependencyLockingProvider = configuration.getResolutionStrategy().getDependencyLockingProvider();
        DependencyLockingState lockingState = dependencyLockingProvider.loadLockState(configuration.getName());
        if (lockingState.mustValidateLockState() && !lockingState.getLockedDependencies().isEmpty()) {
            // Invalid lock state, need to do a real resolution to gather locking failures
            delegate.resolveGraph(configuration, results);
            return;
        }
        dependencyLockingProvider.persistResolvedDependencies(configuration.getName(), Collections.emptySet(), Collections.emptySet());
    }
    Module module = configuration.getModule();
    ModuleVersionIdentifier id = moduleIdentifierFactory.moduleWithVersion(module);
    ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(module);
    ResolutionResult emptyResult = DefaultResolutionResultBuilder.empty(id, componentIdentifier, configuration.getAttributes());
    ResolvedLocalComponentsResult emptyProjectResult = new ResolvedLocalComponentsResultGraphVisitor(thisBuild);
    results.graphResolved(emptyResult, emptyProjectResult, EmptyResults.INSTANCE);
}
Also used : ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) DependencyLockingProvider(org.gradle.api.internal.artifacts.dsl.dependencies.DependencyLockingProvider) DependencyLockingState(org.gradle.api.internal.artifacts.dsl.dependencies.DependencyLockingState) ResolutionResult(org.gradle.api.artifacts.result.ResolutionResult) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) Module(org.gradle.api.internal.artifacts.Module) ResolvedLocalComponentsResult(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResult) ResolvedLocalComponentsResultGraphVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResultGraphVisitor)

Aggregations

ResolvedLocalComponentsResultGraphVisitor (org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResultGraphVisitor)4 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)2 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)2 ResolutionResult (org.gradle.api.artifacts.result.ResolutionResult)2 Module (org.gradle.api.internal.artifacts.Module)2 ResolutionStrategyInternal (org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal)2 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 ResolvedLocalComponentsResult (org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedLocalComponentsResult)2 ImmutableList (com.google.common.collect.ImmutableList)1 UnresolvedDependency (org.gradle.api.artifacts.UnresolvedDependency)1 ProjectComponentIdentifier (org.gradle.api.artifacts.component.ProjectComponentIdentifier)1 ResolvedComponentResult (org.gradle.api.artifacts.result.ResolvedComponentResult)1 DependencyLockingProvider (org.gradle.api.internal.artifacts.dsl.dependencies.DependencyLockingProvider)1 DependencyLockingState (org.gradle.api.internal.artifacts.dsl.dependencies.DependencyLockingState)1 DependencyArtifactsVisitor (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DependencyArtifactsVisitor)1 VisitedArtifactsResults (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.VisitedArtifactsResults)1