protected BuildingState(boolean isChanged, GroupedList<SkyKey> lastBuildDirectDeps) { this.lastBuildDirectDeps = lastBuildDirectDeps; Preconditions.checkState( isChanged || !this.lastBuildDirectDeps.isEmpty(), "%s is being marked dirty, not changed, but has no children that could have dirtied it", this); dirtyState = isChanged ? DirtyState.NEEDS_REBUILDING : DirtyState.CHECK_DEPENDENCIES; // We need to iterate through the deps to see if they have changed, or to remove them if one // has. Initialize the iterator. dirtyDirectDepIterator = lastBuildDirectDeps.iterator(); }
/** * Removes a set of deps from the set of known direct deps. This is complicated by the need to * maintain the group data. If we remove a dep that ended a group, then its predecessor's group * data must be changed to indicate that it now ends the group. * * @see NodeEntry#removeUnfinishedDeps */ void removeDirectDeps(Set<SkyKey> unfinishedDeps) { directDeps.remove(unfinishedDeps); }
/** * Returns the direct deps found so far on this build. Should only be called before the node has * finished building. * * @see NodeEntry#getTemporaryDirectDeps() */ Set<SkyKey> getDirectDepsForBuild() { return directDeps.toSet(); }
void addDirectDeps(GroupedListHelper<SkyKey> depsThisRun) { directDeps.append(depsThisRun); }
boolean noDepsLastBuild() { return lastBuildDirectDeps.isEmpty(); }
/** * Returns true if the deps requested during this evaluation are exactly those requested the last * time this node was built, in the same order. */ boolean depsUnchangedFromLastBuild() { checkFinishedBuildingWhenAboutToSetValue(); return lastBuildDirectDeps.equals(directDeps); }
/** * Returns true if {@code newValue}.equals the value from the last time this node was built, and * the deps requested during this evaluation are exactly those requested the last time this node * was built, in the same order. Should only be used by {@link NodeEntry#setValue}. */ boolean unchangedFromLastBuild(SkyValue newValue) { checkFinishedBuildingWhenAboutToSetValue(); return getLastBuildValue().equals(newValue) && lastBuildDirectDeps.equals(directDeps); }
/** Returns whether all known children of this node have signaled that they are done. */ boolean isReady() { int directDepsSize = directDeps.size(); Preconditions.checkState(signaledDeps <= directDepsSize, "%s %s", directDepsSize, this); return signaledDeps == directDepsSize; }
/** * Remove all elements of toRemove from this list. It is a fatal error if any elements of * toRemove are not present. Takes time proportional to the size of the list, so should not be * called often. */ public void remove(Set<E> toRemove) { groupedList = GroupedList.remove(groupedList, toRemove); int oldSize = size(); elements.removeAll(toRemove); Preconditions.checkState(oldSize == size() + toRemove.size(), "%s %s", toRemove, this); }