aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar felly <felly@google.com>2018-06-12 16:51:35 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-12 16:53:15 -0700
commitcb1af4ee0915fc294f61a97dc9ef84c4f246dd78 (patch)
tree39e166d58b4d81d8369fcd8fc56385363281c02e /src/main/java/com/google/devtools/build
parentcddddbebe910a8f8199a44c5cc93c41d893954ca (diff)
Fix a bug with flush() not flushing on local writes in ActionFS, and add unit test coverage for this.
Note that ActionFS is not generic enough to make use of FileSystemTest. RELNOTES: None PiperOrigin-RevId: 200304871
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ActionFileSystem.java13
2 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
index 46d81b475c..612632e0f6 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
@@ -216,7 +216,7 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
state.actionFileSystem =
new ActionFileSystem(
skyframeActionExecutor.getExecutorFileSystem(),
- skyframeActionExecutor.getExecRoot(),
+ skyframeActionExecutor.getExecRoot().asFragment(),
directories.getRelativeOutputPath(),
skyframeActionExecutor.getSourceRoots(),
checkedInputs.first,
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionFileSystem.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionFileSystem.java
index af2fe79920..bb4904283c 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionFileSystem.java
@@ -97,7 +97,7 @@ final class ActionFileSystem extends AbstractFileSystemWithCustomStat
ActionFileSystem(
FileSystem delegate,
- Path execRoot,
+ PathFragment execRoot,
String relativeOutputPath,
ImmutableList<Root> sourceRoots,
ActionInputMap inputArtifactData,
@@ -107,7 +107,7 @@ final class ActionFileSystem extends AbstractFileSystemWithCustomStat
Profiler.instance().profile(ProfilerTask.ACTION_FS_STAGING, "staging")) {
this.delegate = delegate;
- this.execRootFragment = execRoot.asFragment();
+ this.execRootFragment = execRoot;
this.outputPathFragment = execRootFragment.getRelative(relativeOutputPath);
this.sourceRoots =
sourceRoots
@@ -639,10 +639,15 @@ final class ActionFileSystem extends AbstractFileSystemWithCustomStat
return new ByteArrayOutputStream() {
@Override
public void close() throws IOException {
+ flush();
super.close();
+ }
+
+ @Override
+ public void flush() throws IOException {
+ super.flush();
byte[] data = toByteArray();
- set(
- new InlineFileArtifactValue(data, Hashing.md5().hashBytes(data).asBytes()),
+ set(new InlineFileArtifactValue(data, Hashing.md5().hashBytes(data).asBytes()),
/*notifyConsumer=*/ true);
}
};