Skip to content

Commit aa0d97c

Browse files
alexjskicopybara-github
authored andcommitted
Add a new method to MetadataProvider to optionally provide a FileSystem to
use when operating on `Artifact` paths. Some of the `ActionInput` instances are `Artifact`s which means that we have the ability to operate on their path. In some cases, we cannot use those paths as is since `FileSystem` redirection is needed. The new method provides that information as well as the `FileSystem` to use in such case. PiperOrigin-RevId: 330612369
1 parent 943d19f commit aa0d97c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/main/java/com/google/devtools/build/lib/actions/MetadataProvider.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package com.google.devtools.build.lib.actions;
1515

1616
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
17+
import com.google.devtools.build.lib.vfs.FileSystem;
1718
import java.io.IOException;
1819
import javax.annotation.Nullable;
1920

@@ -44,4 +45,18 @@ public interface MetadataProvider {
4445
/** Looks up an input from its exec path. */
4546
@Nullable
4647
ActionInput getInput(String execPath);
48+
49+
/**
50+
* Returns a {@link FileSystem} which, if not-null, should be used instead of the one associated
51+
* with {@linkplain Artifact#getPath() the path provided for input artifacts}.
52+
*
53+
* <p>For {@linkplain ActionInput ActionInputs} which are {@linkplain Artifact Artifacts}, we can
54+
* perform direct operations on the {@linkplain Artifact#getPath path}. Doing so, may require
55+
* {@link FileSystem} redirection. This method defines whether that is the case and which {@link
56+
* FileSystem} to use for that.
57+
*/
58+
@Nullable
59+
default FileSystem getFileSystemForInputResolution() {
60+
return null;
61+
}
4762
}

0 commit comments

Comments
 (0)