From 13459b4ee0e743da8f8416fc16bce64687f0c406 Mon Sep 17 00:00:00 2001 From: Michajlo Matijkiw Date: Thu, 12 Mar 2015 19:43:20 +0000 Subject: add baseline functionality for not saving unused artifacts We define unused artifacts as those that aren't consumed by any action. This can be because an action produced more outputs than a dependent action needed, or because it's a top level artifact and we don't care about its contents, just that it was built without issue. Actions may prevent outputs from being discarded by declaring them as mandatory. This is particularly useful for test outputs. The motivation behind this change is to reduce storage overhead for things we can do without. It is worth noting this change doesn't cover all cases. In particular it has difficulty identifying *_binary artifacts as orphaned. This is due to the insertion of a virtual runfiles artifact which depends upon the rule's outputs. -- MOS_MIGRATED_REVID=88467504 --- .../com/google/devtools/build/lib/actions/ActionMetadata.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main/java/com/google/devtools/build/lib/actions/ActionMetadata.java') diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionMetadata.java b/src/main/java/com/google/devtools/build/lib/actions/ActionMetadata.java index 3569f07a8b..64813aed07 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/ActionMetadata.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ActionMetadata.java @@ -123,6 +123,14 @@ public interface ActionMetadata { */ ImmutableSet getOutputs(); + /** + * Returns the set of output Artifacts that are required to be saved. This is + * used to identify items that would otherwise be potentially identified as + * orphaned (not consumed by any downstream {@link Action}s and potentially + * discarded during the build process. + */ + public ImmutableSet getMandatoryOutputs(); + /** * Returns the "primary" input of this action, if applicable. * -- cgit v1.2.3