use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionReasonInternal in project gradle by gradle.
the class ComponentState method getSelectionReason.
@Override
public ComponentSelectionReason getSelectionReason() {
if (root) {
return ComponentSelectionReasons.root();
}
if (cachedReason != null) {
return cachedReason;
}
ComponentSelectionReasonInternal reason = ComponentSelectionReasons.empty();
for (final SelectorState selectorState : module.getSelectors()) {
if (selectorState.getFailure() == null) {
selectorState.addReasonsForSelector(reason);
}
}
for (ComponentSelectionDescriptorInternal selectionCause : VersionConflictResolutionDetails.mergeCauses(selectionCauses)) {
reason.addCause(selectionCause);
}
cachedReason = reason;
return reason;
}
use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionReasonInternal 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.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionReasonInternal in project gradle by gradle.
the class SelectionReasonHelper method getReasonDescription.
public static String getReasonDescription(ComponentSelectionReason reason) {
ComponentSelectionReasonInternal r = (ComponentSelectionReasonInternal) reason;
String description = getReasonDescription(r);
if (reason.isConstrained()) {
if (!r.hasCustomDescriptions()) {
return "via constraint";
} else {
return "via constraint, " + description;
}
}
return description;
}
use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionReasonInternal in project gradle by gradle.
the class RejectedModuleMessageBuilder method renderReason.
private static void renderReason(StringBuilder sb, SelectorState selector) {
ComponentSelectionReasonInternal selectionReason = selector.getSelectionReason();
if (selectionReason.hasCustomDescriptions()) {
sb.append(" because of the following reason");
List<String> reasons = Lists.newArrayListWithExpectedSize(1);
for (ComponentSelectionDescriptor componentSelectionDescriptor : selectionReason.getDescriptions()) {
ComponentSelectionDescriptorInternal next = (ComponentSelectionDescriptorInternal) componentSelectionDescriptor;
if (next.hasCustomDescription()) {
reasons.add(next.getDescription());
}
}
if (reasons.size() == 1) {
sb.append(": ").append(reasons.get(0));
} else {
sb.append("s: ");
Joiner.on(", ").appendTo(sb, reasons);
}
}
}
Aggregations