diff options
author | shahan <shahan@google.com> | 2018-03-15 14:18:46 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-03-15 14:20:29 -0700 |
commit | 18726b7e62ab40fa7d1531af7f72fca17abcdb0a (patch) | |
tree | 5da2d9407b172bfefc58202ca6901bc54040490b /src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java | |
parent | 31032f5a089ded7ebeeb2786eb91864ac58e3306 (diff) |
Begins cleanup to allow ActionFS to be injected into all action executions.
PiperOrigin-RevId: 189244665
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java index f356559a86..8a96476d30 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java +++ b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java @@ -135,6 +135,22 @@ public class ActionExecutionContext implements Closeable { } /** + * Returns the path for an ActionInput. + * + * <p>Notably, in the future, we want any action-scoped artifacts to resolve paths using this + * method instead of {@link Artifact#getPath} because that does not allow filesystem injection. + * + * <p>TODO(shahan): cleanup {@link Action}-scoped references to {@link Artifact.getPath}. + */ + public Path getInputPath(ActionInput input) { + if (input instanceof Artifact) { + // TODO(shahan): replace this with actual logic once we understand what it is. + return ((Artifact) input).getPath(); + } + return executor.getExecRoot().getRelative(input.getExecPath()); + } + + /** * Returns whether failures should have verbose error messages. */ public boolean getVerboseFailures() { |