use of org.gradle.api.tasks.diagnostics.internal.graph.nodes.Section in project gradle by gradle.
the class DependencyInsightReporter method createHeaderForDependency.
private DependencyReportHeader createHeaderForDependency(DependencyEdge dependency, Set<Throwable> alreadyReportedErrors) {
ComponentSelectionReasonInternal reason = (ComponentSelectionReasonInternal) dependency.getReason();
Section selectionReasonsSection = buildSelectionReasonSection(reason);
List<Section> reasonSections = selectionReasonsSection.getChildren();
String reasonShortDescription;
List<Section> extraDetails = Lists.newArrayList();
boolean displayFullReasonSection = reason.hasCustomDescriptions() || reasonSections.size() > 1;
if (displayFullReasonSection) {
reasonShortDescription = null;
extraDetails.add(selectionReasonsSection);
} else {
reasonShortDescription = reasonSections.isEmpty() ? null : reasonSections.get(0).getDescription().toLowerCase();
}
buildFailureSection(dependency, alreadyReportedErrors, extraDetails);
List<ResolvedVariantResult> selectedVariants = dependency.getSelectedVariants();
return new DependencyReportHeader(dependency, reasonShortDescription, selectedVariants, extraDetails);
}
use of org.gradle.api.tasks.diagnostics.internal.graph.nodes.Section in project gradle by gradle.
the class DependencyInsightReporter method buildSelectionReasonSection.
private static DefaultSection buildSelectionReasonSection(ComponentSelectionReason reason) {
DefaultSection selectionReasons = new DefaultSection("Selection reasons");
for (ComponentSelectionDescriptor entry : reason.getDescriptions()) {
ComponentSelectionDescriptorInternal descriptor = (ComponentSelectionDescriptorInternal) entry;
boolean hasCustomDescription = descriptor.hasCustomDescription();
if (ComponentSelectionReasons.isCauseExpected(descriptor) && !hasCustomDescription) {
// Don't render empty 'requested' reason
continue;
}
Section item = new DefaultSection(render(descriptor));
selectionReasons.addChild(item);
}
return selectionReasons;
}
Aggregations