aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/actions/ActionExecutionContext.java
diff options
context:
space:
mode:
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.java16
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() {