aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/actions
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2016-10-31 13:46:04 +0000
committerGravatar Laszlo Csomor <laszlocsomor@google.com>2016-10-31 15:04:54 +0000
commitbb922271323b418addba47807b84ef71c195af96 (patch)
treedf92b7454892b2a55246d4923133d7bbbe9e1c0e /src/main/java/com/google/devtools/build/lib/actions
parent0a7828386145b460cf13ca556935990df674f502 (diff)
Add experimental flag to stop requiring all transitive modules as inputs.
Requiring all transitive modules to always be available can lead to long critical paths and even unnecessary compiles in combination with the prune_header_modules feature. -- MOS_MIGRATED_REVID=137696794
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions')
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java6
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/Action.java26
2 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java b/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java
index 85ea16dd42..a20888b8f2 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java
@@ -175,6 +175,12 @@ public abstract class AbstractAction implements Action, SkylarkValue {
@Nullable
@Override
+ public Iterable<Artifact> getInputsWhenSkippingInputDiscovery() {
+ return null;
+ }
+
+ @Nullable
+ @Override
public Iterable<Artifact> resolveInputsFromCache(
ArtifactResolver artifactResolver,
PackageRootResolver resolver,
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 54b3d8634d..ecf8b66182 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
@@ -152,6 +152,32 @@ public interface Action extends ActionExecutionMetadata, Describable {
throws ActionExecutionException, InterruptedException;
/**
+ * If an action does not know the exact set of inputs ahead of time, it will usually either do:
+ * <ul>
+ * <li> Execution time pruning: The action provides a superset set of inputs at action creation
+ * time, and prunes inputs during {@link #execute}.
+ * <li> Input discovery: The action provides a subset of inputs at creation time, overwrites
+ * {@link #discoverInputs} to return a superset of inputs depending on the execution context
+ * and optionally prunes the inputs at the end of {@link #execute} to a required subset for
+ * subsequent calls.
+ * </ul>
+ *
+ * This function allows an action that is set up for input discovery, and thus only provides a
+ * minimal set of inputs at creation time, to switch off input discovery depending on the
+ * execution context. To that end the action must:
+ * <ul>
+ * <li>Provide a subset of inputs at creation time
+ * <li>Return {@code null} from {@link #discoverInputs}, indicating no input discovery
+ * <li>Return a superset of inputs that might have been discovered otherwise from here;
+ * this will usually be the set difference between the full set of inputs the action would get
+ * when doing only execution time pruning and the minimal subset provided above.
+ * <li>Prune the set of inputs on execute
+ * </ul>
+ */
+ @Nullable
+ Iterable<Artifact> getInputsWhenSkippingInputDiscovery();
+
+ /**
* 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.