Skip to content

Commit

Permalink
ActionExecutionFunction: no NestedSet implicit iteration
Browse files Browse the repository at this point in the history
This is the last change that makes this class compile with NestedSet not
implementing Iterable anymore.

PiperOrigin-RevId: 289429795
  • Loading branch information
ulfjack authored and copybara-github committed Jan 13, 2020
1 parent a3a2215 commit 6a0f07d
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,8 @@ private SkyFunction.Restart handleLostInputs(
} else if (state.discoveredInputs != null) {
failedActionDeps =
Iterables.concat(
inputDeps.keySet(), Iterables.transform(state.discoveredInputs, Artifact::key));
inputDeps.keySet(),
Iterables.transform(state.discoveredInputs.toList(), Artifact::key));
} else {
failedActionDeps = inputDeps.keySet();
}
Expand Down Expand Up @@ -842,7 +843,7 @@ private ActionExecutionValue checkCacheAndExecuteIfNeeded(
switch (addDiscoveredInputs(
state.inputArtifactData,
state.expandedArtifacts,
filterKnownInputs(state.discoveredInputs, state.inputArtifactData),
state.filterKnownDiscoveredInputs(),
env)) {
case VALUES_MISSING:
return null;
Expand Down Expand Up @@ -959,7 +960,7 @@ public void run(
switch (addDiscoveredInputs(
state.inputArtifactData,
state.expandedArtifacts,
filterKnownInputs(state.discoveredInputs, state.inputArtifactData),
state.filterKnownDiscoveredInputs(),
env)) {
case VALUES_MISSING:
return;
Expand Down Expand Up @@ -1283,11 +1284,6 @@ private static <S extends ActionInputMapSink, R> R accumulateInputs(
inputArtifactData, expandedArtifacts, filesetsInsideRunfiles, topLevelFilesets);
}

private static Iterable<Artifact> filterKnownInputs(
Iterable<Artifact> newInputs, ActionInputMap inputArtifactData) {
return Iterables.filter(newInputs, input -> inputArtifactData.getMetadata(input) == null);
}

static boolean actionDependsOnBuildId(Action action) {
// Volatile build actions may need to execute even if none of their known inputs have changed.
// Depending on the build id ensures that these actions have a chance to execute.
Expand Down Expand Up @@ -1389,6 +1385,11 @@ void updateFileSystemContext(
}
}

Iterable<Artifact> filterKnownDiscoveredInputs() {
return Iterables.filter(
discoveredInputs.toList(), input -> inputArtifactData.getMetadata(input) == null);
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
Expand Down

0 comments on commit 6a0f07d

Please sign in to comment.