use of org.gradle.internal.resolve.ModuleVersionResolveException in project gradle by gradle.
the class DefaultResolutionResultBuilder method addExtraFailures.
public void addExtraFailures(Long rootId, Set<UnresolvedDependency> extraFailures) {
DefaultResolvedComponentResult root = modules.get(rootId);
for (UnresolvedDependency failure : extraFailures) {
ModuleVersionSelector failureSelector = failure.getSelector();
ModuleComponentSelector failureComponentSelector = DefaultModuleComponentSelector.newSelector(failureSelector.getModule(), failureSelector.getVersion());
root.addDependency(dependencyResultFactory.createUnresolvedDependency(failureComponentSelector, root, true, ComponentSelectionReasons.of(DEPENDENCY_LOCKING), new ModuleVersionResolveException(failureComponentSelector, () -> "Dependency lock state out of date", failure.getProblem())));
}
}
use of org.gradle.internal.resolve.ModuleVersionResolveException in project gradle by gradle.
the class DependencyResultSerializer method read.
public ResolvedGraphDependency read(Decoder decoder, Map<Long, ComponentSelector> selectors, Map<ComponentSelector, ModuleVersionResolveException> failures) throws IOException {
Long selectorId = decoder.readSmallLong();
ComponentSelector requested = selectors.get(selectorId);
boolean constraint = decoder.readBoolean();
ResolvedVariantResult fromVariant = resolvedVariantResultSerializer.read(decoder);
byte resultByte = decoder.readByte();
if (resultByte == SUCCESSFUL) {
Long selectedId = decoder.readSmallLong();
return new DetachedResolvedGraphDependency(requested, selectedId, null, null, constraint, fromVariant, resolvedVariantResultSerializer.read(decoder));
} else if (resultByte == FAILED) {
ComponentSelectionReason reason = componentSelectionReasonSerializer.read(decoder);
ModuleVersionResolveException failure = failures.get(requested);
return new DetachedResolvedGraphDependency(requested, null, reason, failure, constraint, fromVariant, null);
} else {
throw new IllegalArgumentException("Unknown result type: " + resultByte);
}
}
use of org.gradle.internal.resolve.ModuleVersionResolveException in project gradle by gradle.
the class CompositeBuildDependencySubstitutions method getReplacementFor.
private ProjectComponentIdentifier getReplacementFor(ModuleComponentSelector selector) {
ModuleIdentifier candidateId = selector.getModuleIdentifier();
Collection<ProjectComponentIdentifier> providingProjects = replacementMap.get(candidateId);
if (providingProjects.isEmpty()) {
LOGGER.debug("Found no composite build substitute for module '{}'.", candidateId);
return null;
}
if (providingProjects.size() == 1) {
ProjectComponentIdentifier match = providingProjects.iterator().next();
LOGGER.info("Found project '{}' as substitute for module '{}'.", match, candidateId);
return match;
}
throw new ModuleVersionResolveException(selector, () -> {
SortedSet<String> sortedProjects = providingProjects.stream().map(ComponentIdentifier::getDisplayName).collect(Collectors.toCollection(TreeSet::new));
return String.format("Module version '%s' is not unique in composite: can be provided by %s.", selector.getDisplayName(), sortedProjects);
});
}
Aggregations