Search in sources :

Example 1 with ComponentState

use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.ComponentState in project gradle by gradle.

the class DefaultArtifactDependencyResolver method createModuleConflictHandler.

private ModuleConflictHandler createModuleConflictHandler(ResolutionStrategyInternal resolutionStrategy, GlobalDependencyResolutionRules metadataHandler) {
    ConflictResolution conflictResolution = resolutionStrategy.getConflictResolution();
    ModuleConflictResolver<ComponentState> conflictResolver = new ConflictResolverFactory(versionComparator, versionParser).createConflictResolver(conflictResolution);
    return new DefaultConflictHandler(conflictResolver, metadataHandler.getModuleMetadataProcessor().getModuleReplacements());
}
Also used : DefaultConflictHandler(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.conflicts.DefaultConflictHandler) ConflictResolution(org.gradle.api.internal.artifacts.configurations.ConflictResolution) ComponentState(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.ComponentState)

Example 2 with ComponentState

use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.ComponentState in project gradle by gradle.

the class DefaultConflictHandler method resolveNextConflict.

/**
 * Resolves the conflict by delegating to the conflict resolver who selects single version from given candidates. Executes provided action against the conflict resolution result object.
 */
@Override
public void resolveNextConflict(Action<ConflictResolutionResult> resolutionAction) {
    assert hasConflicts();
    ConflictContainer<ModuleIdentifier, ComponentState>.Conflict conflict = conflicts.popConflict();
    ConflictResolverDetails<ComponentState> details = new DefaultConflictResolverDetails<>(conflict.candidates);
    compositeResolver.select(details);
    if (details.hasFailure()) {
        throw UncheckedException.throwAsUncheckedException(details.getFailure());
    }
    ComponentResolutionState selected = details.getSelected();
    ConflictResolutionResult result = new DefaultConflictResolutionResult(conflict.participants, selected);
    resolutionAction.execute(result);
    if (selected != null) {
        maybeSetReason(conflict.participants, selected);
    }
    LOGGER.debug("Selected {} from conflicting modules {}.", selected, conflict.candidates);
}
Also used : ComponentResolutionState(org.gradle.api.internal.artifacts.ivyservice.resolveengine.ComponentResolutionState) ComponentState(org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.ComponentState)

Aggregations

ComponentState (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.ComponentState)2 ConflictResolution (org.gradle.api.internal.artifacts.configurations.ConflictResolution)1 ComponentResolutionState (org.gradle.api.internal.artifacts.ivyservice.resolveengine.ComponentResolutionState)1 DefaultConflictHandler (org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.conflicts.DefaultConflictHandler)1