use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class Unions method tryGroupUnion.
private ExcludeSpec tryGroupUnion(GroupExclude left, ExcludeSpec right) {
String leftGroup = left.getGroup();
if (right instanceof ModuleIdExclude) {
ModuleIdExclude mie = (ModuleIdExclude) right;
if (mie.getModuleId().getGroup().equals(leftGroup)) {
return left;
}
}
if (right instanceof ModuleIdSetExclude) {
ModuleIdSetExclude ids = (ModuleIdSetExclude) right;
Set<ModuleIdentifier> items = ids.getModuleIds().stream().filter(id -> !id.getGroup().equals(leftGroup)).collect(Collectors.toSet());
if (items.size() == 1) {
return factory.anyOf(left, factory.moduleId(items.iterator().next()));
}
if (items.isEmpty()) {
return left;
}
if (items.size() != ids.getModuleIds().size()) {
return factory.anyOf(left, factory.moduleIdSet(items));
}
}
return null;
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class Unions method tryModuleSetUnion.
private ExcludeSpec tryModuleSetUnion(ModuleSetExclude left, ExcludeSpec right) {
Set<String> leftModules = left.getModules();
if (right instanceof ModuleIdExclude) {
ModuleIdExclude mie = (ModuleIdExclude) right;
if (leftModules.contains(mie.getModuleId().getName())) {
return left;
}
}
if (right instanceof ModuleIdSetExclude) {
ModuleIdSetExclude ids = (ModuleIdSetExclude) right;
Set<ModuleIdentifier> items = ids.getModuleIds().stream().filter(id -> !leftModules.contains(id.getName())).collect(Collectors.toSet());
if (items.size() == 1) {
return factory.anyOf(left, factory.moduleId(items.iterator().next()));
}
if (items.isEmpty()) {
return left;
}
if (items.size() != ids.getModuleIds().size()) {
return factory.anyOf(left, factory.moduleIdSet(items));
}
}
return null;
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class MessageBuilderHelper method pathTo.
static Collection<String> pathTo(EdgeState edge, boolean includeLast) {
List<List<EdgeState>> acc = Lists.newArrayListWithExpectedSize(1);
pathTo(edge, Lists.newArrayList(), acc, Sets.newHashSet());
List<String> result = Lists.newArrayListWithCapacity(acc.size());
for (List<EdgeState> path : acc) {
EdgeState target = Iterators.getLast(path.iterator());
StringBuilder sb = new StringBuilder();
if (target.getSelector().getDependencyMetadata().isConstraint()) {
sb.append("Constraint path ");
} else {
sb.append("Dependency path ");
}
boolean first = true;
String variantDetails = null;
for (EdgeState e : path) {
if (!first) {
sb.append(" --> ");
}
first = false;
ModuleVersionIdentifier id = e.getFrom().getResolvedConfigurationId().getId();
sb.append('\'').append(id).append('\'');
if (variantDetails != null) {
sb.append(variantDetails);
}
variantDetails = variantDetails(e);
}
if (includeLast) {
sb.append(" --> ");
SelectorState selector = edge.getSelector();
ModuleIdentifier moduleId = selector.getTargetModule().getId();
sb.append('\'').append(moduleId.getGroup()).append(':').append(moduleId.getName()).append('\'');
if (variantDetails != null) {
sb.append(variantDetails);
}
}
result.add(sb.toString());
}
return result;
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class NodeState method visitAdditionalConstraints.
/**
* Iterate over the dependencies originating in this node, adding only the constraints listed
* in upcomingNoLongerPendingConstraints
*/
private void visitAdditionalConstraints(Collection<EdgeState> discoveredEdges) {
if (potentiallyActivatedConstraints == null) {
return;
}
for (ModuleIdentifier module : upcomingNoLongerPendingConstraints) {
Collection<DependencyState> dependencyStates = potentiallyActivatedConstraints.get(module);
if (!dependencyStates.isEmpty()) {
for (DependencyState dependencyState : dependencyStates) {
dependencyState = maybeSubstitute(dependencyState, resolveState.getDependencySubstitutionApplicator());
createAndLinkEdgeState(dependencyState, discoveredEdges, previousTraversalExclusions, false);
}
}
}
upcomingNoLongerPendingConstraints = null;
}
use of org.gradle.api.artifacts.ModuleIdentifier in project gradle by gradle.
the class ResolveState method getSelector.
public SelectorState getSelector(DependencyState dependencyState, boolean ignoreVersion) {
boolean isVirtualPlatformEdge = dependencyState.getDependency() instanceof LenientPlatformDependencyMetadata;
SelectorState selectorState = selectors.computeIfAbsent(new SelectorCacheKey(dependencyState.getRequested(), ignoreVersion, isVirtualPlatformEdge), req -> {
ModuleIdentifier moduleIdentifier = dependencyState.getModuleIdentifier();
return new SelectorState(idGenerator.generateId(), dependencyState, idResolver, this, moduleIdentifier, ignoreVersion);
});
selectorState.update(dependencyState);
return selectorState;
}
Aggregations