Skip to content

Commit

Permalink
Add a new method to MetadataProvider to optionally provide a `FileS…
Browse files Browse the repository at this point in the history
…ystem` 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
  • Loading branch information
alexjski authored and Copybara-Service committed Sep 8, 2020
1 parent 943d19f commit aa0d97c
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package com.google.devtools.build.lib.actions;

import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
import com.google.devtools.build.lib.vfs.FileSystem;
import java.io.IOException;
import javax.annotation.Nullable;

Expand Down Expand Up @@ -44,4 +45,18 @@ public interface MetadataProvider {
/** Looks up an input from its exec path. */
@Nullable
ActionInput getInput(String execPath);

/**
* Returns a {@link FileSystem} which, if not-null, should be used instead of the one associated
* with {@linkplain Artifact#getPath() the path provided for input artifacts}.
*
* <p>For {@linkplain ActionInput ActionInputs} which are {@linkplain Artifact Artifacts}, we can
* perform direct operations on the {@linkplain Artifact#getPath path}. Doing so, may require
* {@link FileSystem} redirection. This method defines whether that is the case and which {@link
* FileSystem} to use for that.
*/
@Nullable
default FileSystem getFileSystemForInputResolution() {
return null;
}
}

0 comments on commit aa0d97c

Please sign in to comment.