Skip to content

Commit

Permalink
Special case for deferred selector
Browse files Browse the repository at this point in the history
When a dependency activates a pending constraint, do not defer
selection if the pending constraint comes from a virtual platform.
Because of their special aspects, virtual platforms really need to be
handled in line each time.

Fixes #9882
  • Loading branch information
ljacomet committed Jul 8, 2019
1 parent 3d12165 commit de4514c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Expand Up @@ -68,7 +68,7 @@ private boolean markNoLongerPending(PendingDependencies pendingDependencies) {
noLongerPending = Lists.newLinkedList();
}
noLongerPending.add(pendingDependencies);
activatedPending = true;
activatedPending = pendingDependencies.shouldReportActivatePending();
}
pendingDependencies.increaseHardEdgeCount();
return activatedPending;
Expand Down
Expand Up @@ -24,11 +24,13 @@ public class PendingDependencies {
private final ModuleIdentifier moduleIdentifier;
private final Set<NodeState> affectedComponents;
private int hardEdges;
private boolean reportActivePending;

PendingDependencies(ModuleIdentifier moduleIdentifier) {
this.moduleIdentifier = moduleIdentifier;
this.affectedComponents = Sets.newLinkedHashSet();
this.hardEdges = 0;
this.reportActivePending = true;
}

ModuleIdentifier getModuleIdentifier() {
Expand All @@ -40,13 +42,17 @@ void addNode(NodeState state) {
throw new IllegalStateException("Cannot add a pending node for a dependency which is not pending");
}
affectedComponents.add(state);
if (state.getComponent().getModule().isVirtualPlatform()) {
reportActivePending = false;
}
}

void turnIntoHardDependencies() {
for (NodeState affectedComponent : affectedComponents) {
affectedComponent.prepareForConstraintNoLongerPending(moduleIdentifier);
}
affectedComponents.clear();
reportActivePending = true;
}

public boolean isPending() {
Expand All @@ -65,4 +71,8 @@ void decreaseHardEdgeCount() {
assert hardEdges > 0 : "Cannot remove a hard edge when none recorded";
hardEdges--;
}

public boolean shouldReportActivatePending() {
return reportActivePending;
}
}

0 comments on commit de4514c

Please sign in to comment.