use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvedArtifactSet 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, SelectedFileDependencyResults 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) {
if (visitor.includeFiles()) {
fileDependencyResults.getArtifacts().visit(visitor);
}
artifactResults.getArtifacts().visit(visitor);
return;
}
if (visitor.includeFiles()) {
for (Map.Entry<FileCollectionDependency, ResolvedArtifactSet> entry : fileDependencyResults.getFirstLevelFiles().entrySet()) {
if (dependencySpec.isSatisfiedBy(entry.getKey())) {
entry.getValue().visit(visitor);
}
}
}
CachingDirectedGraphWalker<DependencyGraphNodeResult, ResolvedArtifact> walker = new CachingDirectedGraphWalker<DependencyGraphNodeResult, ResolvedArtifact>(new ResolvedDependencyArtifactsGraph(visitor, fileDependencyResults));
DependencyGraphNodeResult rootNode = loadTransientGraphResults(artifactResults).getRootNode();
for (DependencyGraphNodeResult node : getFirstLevelNodes(dependencySpec)) {
node.getArtifactsForIncomingEdge(rootNode).visit(visitor);
walker.add(node);
}
walker.findValues();
}
use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvedArtifactSet in project gradle by gradle.
the class DefaultVisitedFileDependencyResults method select.
@Override
public SelectedFileDependencyResults select(Spec<? super ComponentIdentifier> componentFilter, VariantSelector selector) {
// Wrap each file dependency in a set that performs variant selection and transformation
// Also merge together the artifact sets for each configuration node
ImmutableMap.Builder<Long, ResolvedArtifactSet> filesByConfigBuilder = ImmutableMap.builder();
List<DynamicResolvedArtifactSet> allArtifacts = Lists.newArrayList();
for (Long key : filesByNodeId.keySet()) {
Set<FileDependencyArtifactSet> artifactsForConfiguration = filesByNodeId.get(key);
List<DynamicResolvedArtifactSet> selectedArtifactsForConfiguration = new ArrayList<DynamicResolvedArtifactSet>(artifactsForConfiguration.size());
for (FileDependencyArtifactSet artifactSet : artifactsForConfiguration) {
selectedArtifactsForConfiguration.add(artifactSet.select(componentFilter, selector));
}
filesByConfigBuilder.put(key, CompositeArtifactSet.of(selectedArtifactsForConfiguration));
allArtifacts.addAll(selectedArtifactsForConfiguration);
}
ResolvedArtifactSet allFiles = new ParallelResolveArtifactSet(CompositeDynamicArtifactSet.create(allArtifacts), buildOperationProcessor);
ImmutableMap.Builder<FileCollectionDependency, ResolvedArtifactSet> rootFilesBuilder = ImmutableMap.builder();
for (Map.Entry<FileCollectionDependency, FileDependencyArtifactSet> entry : rootFiles.entrySet()) {
rootFilesBuilder.put(entry.getKey(), entry.getValue().select(componentFilter, selector));
}
ImmutableMap<Long, ResolvedArtifactSet> filesByConfig = filesByConfigBuilder.build();
return new DefaultFileDependencyResults(rootFilesBuilder.build(), allFiles, filesByConfig);
}
Aggregations