diff options
author | 2015-03-18 21:59:16 +0000 | |
---|---|---|
committer | 2015-03-20 14:32:58 +0000 | |
commit | a7c84b508c3c0a31e589de0de006b6cb9b7fd515 (patch) | |
tree | 11338ff270a4d9a0b319ab10dfbfa97244ac4d4f /src/main/java/com/google/devtools/build/lib/actions/Action.java | |
parent | bedbc441984d8a8dbf623b9a7669a4692eeeefff (diff) |
Delay updating inputs of an action when processing the action cache until it is known that the action is a cache hit.
This adds momentary memory overhead when checking the action cache, but should prevent a host of potential errors.
Note that this cl assumes that an action that discovers its inputs does *not* take the names of its inputs into account when calculating its key, which is already stated as part of the javadoc of Action#getKey.
--
MOS_MIGRATED_REVID=88971626
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions/Action.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/actions/Action.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/Action.java b/src/main/java/com/google/devtools/build/lib/actions/Action.java index 09c50fb1fc..3581ae0a31 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/Action.java +++ b/src/main/java/com/google/devtools/build/lib/actions/Action.java @@ -107,26 +107,33 @@ public interface Action extends ActionMetadata, Describable { throws ActionExecutionException, InterruptedException; /** - * Method used to update action inputs based on the information contained in + * Method used to resolve action inputs based on the information contained in * the action cache. It will be called iff inputsKnown() is false for the * given action instance and there is a related cache entry in the action * cache. * * Method must be redefined for any action that may return - * inputsKnown() == false. It also expects that implementation will ensure - * that inputsKnown() returns true after call to this method. + * inputsKnown() == false. * * @param artifactResolver the artifact factory that can be used to manufacture artifacts - * @param inputPaths List of relative (to the execution root) input paths * @param resolver object which helps to resolve some of the artifacts - * @return false if some dependencies are missing and we need to update again later, - * otherwise true. + * @param inputPaths List of relative (to the execution root) input paths + * @return List of Artifacts corresponding to inputPaths, or null if some dependencies were + * missing and we need to try again later. */ - boolean updateInputsFromCache( + @Nullable + Iterable<Artifact> resolveInputsFromCache( ArtifactResolver artifactResolver, PackageRootResolver resolver, Collection<PathFragment> inputPaths); /** + * Informs the action that its inputs are {@code inputs}, and that its inputs are now known. Can + * only be called for actions that discover inputs. After this method is called, + * {@link ActionMetadata#inputsKnown} should return true. + */ + void updateInputs(Iterable<Artifact> inputs); + + /** * Return a best-guess estimate of the operation's resource consumption on the * local host itself for use in scheduling. * |