diff options
author | janakr <janakr@google.com> | 2018-02-15 10:33:53 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-15 10:35:15 -0800 |
commit | cb314a2e36031c8a5f1dd26bb3b94f1b8f1cb901 (patch) | |
tree | e04b828849bd9b5be4d4bc1dde67b46cf46de9d7 /src/main/java/com/google/devtools/build/lib/actions/ActionLookupValue.java | |
parent | 10b1a5fc3ade9c5f12078cd616218f9ef45ef13c (diff) |
Stop storing ActionTemplate in a SkyKey: it's too heavyweight. Use the same mechanism as for normal actions, have the ActionTemplateExpansionFunction look the template up when needed.
PiperOrigin-RevId: 185861672
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions/ActionLookupValue.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/actions/ActionLookupValue.java | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionLookupValue.java b/src/main/java/com/google/devtools/build/lib/actions/ActionLookupValue.java index 000f359315..33555a20c7 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/ActionLookupValue.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ActionLookupValue.java @@ -122,18 +122,19 @@ public class ActionLookupValue implements SkyValue { return Preconditions.checkNotNull(actions.get(index), "null action: %s %s", index, this); } + public ActionTemplate<?> getActionTemplate(int index) { + ActionAnalysisMetadata result = getActionAnalysisMetadata(index); + Preconditions.checkState( + result instanceof ActionTemplate, "Not action template: %s %s %s", result, index, this); + return (ActionTemplate<?>) result; + } + /** - * Returns the {@link ActionAnalysisMetadata} at index {@code index} if it is present and - * <i>not</i> an {@link Action}. Tree artifacts need their {@code ActionTemplate}s in order to - * generate the correct actions, but in general most actions are not needed after they are - * executed and may not even be available. + * Returns if the action at {@code index} is an {@link ActionTemplate} so that tree artifacts can + * take the proper action. */ - public ActionAnalysisMetadata getIfPresentAndNotAction(int index) { - ActionAnalysisMetadata actionAnalysisMetadata = actions.get(index); - if (!(actionAnalysisMetadata instanceof Action)) { - return actionAnalysisMetadata; - } - return null; + public boolean isActionTemplate(int index) { + return actions.get(index) instanceof ActionTemplate; } /** To be used only when checking consistency of the action graph -- not by other values. */ |