use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.conflicts.DefaultConflictResolverDetails in project gradle by gradle.
the class ProjectDependencyForcingResolver method select.
@Override
public <T extends ComponentResolutionState> void select(ConflictResolverDetails<T> details) {
// the collection will only be initialized if more than one project candidate is found
Collection<T> projectCandidates = null;
T foundProjectCandidate = null;
// fine one or more project dependencies among conflicting modules
for (T candidate : details.getCandidates()) {
ComponentResolveMetadata metaData = candidate.getMetadata();
if (metaData != null && metaData.getId() instanceof ProjectComponentIdentifier) {
if (foundProjectCandidate == null) {
// found the first project dependency
foundProjectCandidate = candidate;
} else {
// found more than one
if (projectCandidates == null) {
projectCandidates = new ArrayList<T>();
projectCandidates.add(foundProjectCandidate);
}
projectCandidates.add(candidate);
}
}
}
// let the delegate resolver select among them
if (projectCandidates != null) {
ConflictResolverDetails<T> projectDetails = new DefaultConflictResolverDetails<T>(Cast.<List<T>>uncheckedCast(projectCandidates));
delegate.select(projectDetails);
details.select(projectDetails.getSelected());
return;
}
// if found only one project dependency - return it, otherwise call the next resolver
if (foundProjectCandidate != null) {
details.select(foundProjectCandidate);
} else {
delegate.select(details);
}
}
Aggregations