Search in sources :

Example 11 with ComponentSelectionDescriptorInternal

use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionDescriptorInternal in project gradle by gradle.

the class SelectorStateResolver method resolveConflicts.

private T resolveConflicts(Collection<T> candidates) {
    // Do conflict resolution to choose the best out of current selection and candidate.
    ConflictResolverDetails<T> details = new DefaultConflictResolverDetails<>(candidates);
    conflictResolver.select(details);
    T selected = details.getSelected();
    if (details.hasFailure()) {
        throw UncheckedException.throwAsUncheckedException(details.getFailure());
    } else {
        ComponentSelectionDescriptorInternal desc = ComponentSelectionReasons.CONFLICT_RESOLUTION;
        selected.addCause(desc.withDescription(new VersionConflictResolutionDetails(candidates)));
    }
    return selected;
}
Also used : DefaultConflictResolverDetails(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.conflicts.DefaultConflictResolverDetails) ComponentSelectionDescriptorInternal(org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionDescriptorInternal) VersionConflictResolutionDetails(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.conflicts.VersionConflictResolutionDetails)

Example 12 with ComponentSelectionDescriptorInternal

use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionDescriptorInternal 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

ComponentSelectionDescriptorInternal (org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionDescriptorInternal)12 ModuleIdentifier (org.gradle.api.artifacts.ModuleIdentifier)2 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)2 ComponentSelectionDescriptor (org.gradle.api.artifacts.result.ComponentSelectionDescriptor)2 ComponentSelectionReasonInternal (org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.ComponentSelectionReasonInternal)2 DefaultModuleComponentSelector (org.gradle.internal.component.external.model.DefaultModuleComponentSelector)2 Action (org.gradle.api.Action)1 ArtifactSelectionDetails (org.gradle.api.artifacts.ArtifactSelectionDetails)1 DependencySubstitution (org.gradle.api.artifacts.DependencySubstitution)1 ComponentSelector (org.gradle.api.artifacts.component.ComponentSelector)1 ProjectComponentSelector (org.gradle.api.artifacts.component.ProjectComponentSelector)1 ModuleReplacementsData (org.gradle.api.internal.artifacts.dsl.ModuleReplacementsData)1 ComponentResolutionState (org.gradle.api.internal.artifacts.ivyservice.resolveengine.ComponentResolutionState)1 DefaultConflictResolverDetails (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.conflicts.DefaultConflictResolverDetails)1 VersionConflictResolutionDetails (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.conflicts.VersionConflictResolutionDetails)1 DefaultSection (org.gradle.api.tasks.diagnostics.internal.graph.nodes.DefaultSection)1 Section (org.gradle.api.tasks.diagnostics.internal.graph.nodes.Section)1 DefaultProjectComponentSelector (org.gradle.internal.component.local.model.DefaultProjectComponentSelector)1 RejectedByAttributesVersion (org.gradle.internal.resolve.RejectedByAttributesVersion)1 RejectedByRuleVersion (org.gradle.internal.resolve.RejectedByRuleVersion)1