use of org.gradle.api.tasks.diagnostics.internal.graph.nodes.ResolvedDependencyEdge in project gradle by gradle.
the class DependencyInsightReporter method prepare.
public Collection<RenderableDependency> prepare(Collection<DependencyResult> input, VersionSelectorScheme versionSelectorScheme, VersionComparator versionComparator) {
LinkedList<RenderableDependency> out = new LinkedList<RenderableDependency>();
List<DependencyEdge> dependencies = CollectionUtils.collect(input, new Transformer<DependencyEdge, DependencyResult>() {
@Override
public DependencyEdge transform(DependencyResult result) {
if (result instanceof UnresolvedDependencyResult) {
return new UnresolvedDependencyEdge((UnresolvedDependencyResult) result);
} else {
return new ResolvedDependencyEdge((ResolvedDependencyResult) result);
}
}
});
Collection<DependencyEdge> sorted = DependencyResultSorter.sort(dependencies, versionSelectorScheme, versionComparator);
// remember if module id was annotated
HashSet<ComponentIdentifier> annotated = new HashSet<ComponentIdentifier>();
RequestedVersion current = null;
for (DependencyEdge dependency : sorted) {
ResolvedVariantResult selectedVariant = dependency.getSelectedVariant();
// add description only to the first module
if (annotated.add(dependency.getActual())) {
// add a heading dependency with the annotation if the dependency does not exist in the graph
if (!dependency.getRequested().matchesStrictly(dependency.getActual())) {
out.add(new DependencyReportHeader(dependency, selectedVariant));
current = new RequestedVersion(dependency.getRequested(), dependency.getActual(), dependency.isResolvable(), null, selectedVariant);
out.add(current);
} else {
current = new RequestedVersion(dependency.getRequested(), dependency.getActual(), dependency.isResolvable(), getReasonDescription(dependency.getReason()), selectedVariant);
out.add(current);
}
} else if (!current.getRequested().equals(dependency.getRequested())) {
current = new RequestedVersion(dependency.getRequested(), dependency.getActual(), dependency.isResolvable(), null, selectedVariant);
out.add(current);
}
current.addChild(dependency);
}
return out;
}
Aggregations