diff options
author | felly <felly@google.com> | 2018-06-22 07:44:45 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-22 07:46:03 -0700 |
commit | dc97fd15dc53489211ca65fbbf85131853a559fc (patch) | |
tree | 13846825856db4266a98b4feec9db6f1c8e3f5d3 /src/main/java/com/google/devtools/build/lib/actions | |
parent | 8765ddfd40188a52ac4b034d54663a6d7346cc61 (diff) |
Add a method in FileArtifactValue to create a new instance given an existing FileStatus.
PiperOrigin-RevId: 201683773
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/actions/FileArtifactValue.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/FileArtifactValue.java b/src/main/java/com/google/devtools/build/lib/actions/FileArtifactValue.java index 0ae5592a68..83da23a0fc 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/FileArtifactValue.java +++ b/src/main/java/com/google/devtools/build/lib/actions/FileArtifactValue.java @@ -179,12 +179,14 @@ public abstract class FileArtifactValue implements SkyValue { return create(artifact.getPath()); } - @VisibleForTesting public static FileArtifactValue create(Path path) throws IOException { // Caution: there's a race condition between stating the file and computing the // digest. We need to stat first, since we're using the stat to detect changes. // We follow symlinks here to be consistent with getDigest. - FileStatus stat = path.stat(Symlinks.FOLLOW); + return create(path, path.stat(Symlinks.FOLLOW)); + } + + public static FileArtifactValue create(Path path, FileStatus stat) throws IOException { return create(path, stat.isFile(), stat.getSize(), FileContentsProxy.create(stat), null); } |