Search in sources :

Example 6 with FileCollectionDependency

use of org.gradle.api.artifacts.FileCollectionDependency in project gradle by gradle.

the class DefaultLenientConfiguration method visitArtifacts.

/**
 * Recursive, includes unsuccessfully resolved artifacts
 *
 * @param dependencySpec dependency spec
 */
private void visitArtifacts(Spec<? super Dependency> dependencySpec, SelectedArtifactResults artifactResults, VisitedFileDependencyResults fileDependencyResults, ArtifactVisitor visitor) {
    // avoid traversing the graph causing the full ResolvedDependency graph to be loaded for the most typical scenario
    if (dependencySpec == Specs.SATISFIES_ALL) {
        ParallelResolveArtifactSet.wrap(artifactResults.getArtifacts(), buildOperationExecutor).visit(visitor);
        return;
    }
    List<ResolvedArtifactSet> artifactSets = new ArrayList<>();
    for (Map.Entry<FileCollectionDependency, Integer> entry : fileDependencyResults.getFirstLevelFiles().entrySet()) {
        if (dependencySpec.isSatisfiedBy(entry.getKey())) {
            artifactSets.add(artifactResults.getArtifactsWithId(entry.getValue()));
        }
    }
    CachingDirectedGraphWalker<DependencyGraphNodeResult, ResolvedArtifact> walker = new CachingDirectedGraphWalker<>(new ResolvedDependencyArtifactsGraph(artifactSets));
    for (DependencyGraphNodeResult node : getFirstLevelNodes(dependencySpec)) {
        walker.add(node);
    }
    walker.findValues();
    ParallelResolveArtifactSet.wrap(CompositeResolvedArtifactSet.of(artifactSets), buildOperationExecutor).visit(visitor);
}
Also used : DependencyGraphNodeResult(org.gradle.api.internal.artifacts.DependencyGraphNodeResult) ResolvedArtifact(org.gradle.api.artifacts.ResolvedArtifact) ResolvedArtifactSet(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvedArtifactSet) CompositeResolvedArtifactSet(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.CompositeResolvedArtifactSet) ArrayList(java.util.ArrayList) Map(java.util.Map) FileCollectionDependency(org.gradle.api.artifacts.FileCollectionDependency) CachingDirectedGraphWalker(org.gradle.internal.graph.CachingDirectedGraphWalker)

Aggregations

FileCollectionDependency (org.gradle.api.artifacts.FileCollectionDependency)6 Map (java.util.Map)3 Dependency (org.gradle.api.artifacts.Dependency)3 ResolvedArtifactSet (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvedArtifactSet)3 ArrayList (java.util.ArrayList)2 ModuleDependency (org.gradle.api.artifacts.ModuleDependency)2 ResolvedArtifact (org.gradle.api.artifacts.ResolvedArtifact)2 DependencyGraphNodeResult (org.gradle.api.internal.artifacts.DependencyGraphNodeResult)2 AttributeContainerInternal (org.gradle.api.internal.attributes.AttributeContainerInternal)2 CachingDirectedGraphWalker (org.gradle.internal.graph.CachingDirectedGraphWalker)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 FileCollection (org.gradle.api.file.FileCollection)1 CompositeResolvedArtifactSet (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.CompositeResolvedArtifactSet)1 DynamicResolvedArtifactSet (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.DynamicResolvedArtifactSet)1 FileDependencyArtifactSet (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.FileDependencyArtifactSet)1 ParallelResolveArtifactSet (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ParallelResolveArtifactSet)1 AbstractFileCollection (org.gradle.api.internal.file.AbstractFileCollection)1 FileCollectionInternal (org.gradle.api.internal.file.FileCollectionInternal)1 AbstractTaskDependency (org.gradle.api.internal.tasks.AbstractTaskDependency)1 TaskDependency (org.gradle.api.tasks.TaskDependency)1