diff options
author | tomlu <tomlu@google.com> | 2017-08-24 00:44:45 +0200 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2017-08-24 14:00:00 +0200 |
commit | 3fb6ac385df80a5f583072c0b84247d503e330b7 (patch) | |
tree | f708d2e1132a71236307bb1bce3f2179b7701bad /src/test/java/com/google/devtools/build/lib/rules/android/AndroidDataBindingTest.java | |
parent | 4e08dfcf563f1ef036a1561bd5312ad469077049 (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/test/java/com/google/devtools/build/lib/rules/android/AndroidDataBindingTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/android/AndroidDataBindingTest.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidDataBindingTest.java b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidDataBindingTest.java index cac7c2a54b..5dd1e92d14 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/android/AndroidDataBindingTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/android/AndroidDataBindingTest.java @@ -18,6 +18,7 @@ import static com.google.devtools.build.lib.actions.util.ActionsTestUtil.getFirs import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.Artifact; +import com.google.devtools.build.lib.actions.CommandLineExpansionException; import com.google.devtools.build.lib.actions.util.ActionsTestUtil; import com.google.devtools.build.lib.analysis.ConfiguredTarget; import com.google.devtools.build.lib.analysis.actions.ParameterFileWriteAction; @@ -91,10 +92,9 @@ public class AndroidDataBindingTest extends AndroidBuildViewTestCase { "package android.binary; public class MyApp {};"); } - /** - * Returns the .params file contents of a {@link JavaCompileAction} - */ - private Iterable<String> getParamFileContents(JavaCompileAction action) { + /** Returns the .params file contents of a {@link JavaCompileAction} */ + private Iterable<String> getParamFileContents(JavaCompileAction action) + throws CommandLineExpansionException { Artifact paramFile = getFirstArtifactEndingWith(action.getInputs(), "-2.params"); return ((ParameterFileWriteAction) getGeneratingAction(paramFile)).getContents(); } |