Search in sources :

Example 1 with Section

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);
}
Also used : ResolvedVariantResult(org.gradle.api.artifacts.result.ResolvedVariantResult) DependencyReportHeader(org.gradle.api.tasks.diagnostics.internal.graph.nodes.DependencyReportHeader) DefaultSection(org.gradle.api.tasks.diagnostics.internal.graph.nodes.DefaultSection) Section(org.gradle.api.tasks.diagnostics.internal.graph.nodes.Section) ComponentSelectionReasonInternal(org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionReasonInternal)

Example 2 with Section

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;
}
Also used : ComponentSelectionDescriptor(org.gradle.api.artifacts.result.ComponentSelectionDescriptor) ComponentSelectionDescriptorInternal(org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionDescriptorInternal) DefaultSection(org.gradle.api.tasks.diagnostics.internal.graph.nodes.DefaultSection) Section(org.gradle.api.tasks.diagnostics.internal.graph.nodes.Section) DefaultSection(org.gradle.api.tasks.diagnostics.internal.graph.nodes.DefaultSection)

Aggregations

DefaultSection (org.gradle.api.tasks.diagnostics.internal.graph.nodes.DefaultSection)2 Section (org.gradle.api.tasks.diagnostics.internal.graph.nodes.Section)2 ComponentSelectionDescriptor (org.gradle.api.artifacts.result.ComponentSelectionDescriptor)1 ResolvedVariantResult (org.gradle.api.artifacts.result.ResolvedVariantResult)1 ComponentSelectionDescriptorInternal (org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionDescriptorInternal)1 ComponentSelectionReasonInternal (org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionReasonInternal)1 DependencyReportHeader (org.gradle.api.tasks.diagnostics.internal.graph.nodes.DependencyReportHeader)1