aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionMetadata.java
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2017-08-24 00:44:45 +0200
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-08-24 14:00:00 +0200
commit3fb6ac385df80a5f583072c0b84247d503e330b7 (patch)
treef708d2e1132a71236307bb1bce3f2179b7701bad /src/main/java/com/google/devtools/build/lib/actions/ActionExecutionMetadata.java
parent4e08dfcf563f1ef036a1561bd5312ad469077049 (diff)
Allow CommandLine expansion to throw an exception.
This paves the way for Skylark-side compact command lines that can fail during expansion. In general, expansion happens in these scenarios: * Action execution expands the command line to execute it. This is fine since we are well equipped already to handle failing actions. * In the analysis phase we expand command lines to investigate whether we need a params file. This could be moved to the execution phase, which would have the benefit of getting params files out of the action graph and saving memory. * Key computation expands the command line. This could be fixed by allowing command lines to compute their own keys (which wouldn't try to expand the command line). This could have the benefit of being more efficient. * Extra actions expand the command line to construct the extra action proto. This could maybe be deferred to the execution phase (writing the extra action), which would also be more memory efficient. For failed key computations, we return a singleton "error" key. This means multiple actions that will fail will map to the same key. These actions will necessarily fail if executed, so we should not need to worry about these ending up in the action cache. If we do manage to make the command line compute its own keys then this will become moot in the future. RELNOTES: None PiperOrigin-RevId: 166266385
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions/ActionExecutionMetadata.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/ActionExecutionMetadata.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionMetadata.java b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionMetadata.java
index 6184954699..7f4b569b13 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionMetadata.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionMetadata.java
@@ -24,6 +24,17 @@ import javax.annotation.Nullable;
* other than that all methods with side effects must belong to the former.
*/
public interface ActionExecutionMetadata extends ActionAnalysisMetadata {
+
+ /**
+ * Return this key to signify a failed key computation.
+ *
+ * <p>Actions that return this value should fail to execute.
+ *
+ * <p>Consumers must either gracefully handle multiple failed actions having the same key,
+ * (recommended), or check against this value explicitly.
+ */
+ String KEY_ERROR = "1ea50e01-0349-4552-80cf-76cf520e8592";
+
/**
* If this executable can supply verbose information, returns a string that can be used as a
* progress message while this executable is running. A return value of {@code null} indicates no