aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java b/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java
index 0900086aca..38eac7f230 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java
@@ -87,7 +87,6 @@ public final class CommandEnvironment {
private PathFragment relativeWorkingDirectory = PathFragment.EMPTY_FRAGMENT;
private long commandStartTime;
private OutputService outputService;
- private String outputFileSystem;
private Path workingDirectory;
private AtomicReference<AbruptExitException> pendingException = new AtomicReference<>();
@@ -413,10 +412,6 @@ public final class CommandEnvironment {
this.workingDirectory = workingDirectory;
}
- public String getOutputFileSystem() {
- return outputFileSystem;
- }
-
/**
* Hook method called by the BlazeCommandDispatcher prior to the dispatch of
* each command.
@@ -450,8 +445,6 @@ public final class CommandEnvironment {
SkyframeExecutor skyframeExecutor = getSkyframeExecutor();
skyframeExecutor.setOutputService(outputService);
- this.outputFileSystem = determineOutputFileSystem();
-
// Ensure that the working directory will be under the workspace directory.
Path workspace = getWorkspace();
Path workingDirectory;
@@ -507,16 +500,16 @@ public final class CommandEnvironment {
new CommandStartEvent(command.name(), commandId, getClientEnv(), workingDirectory));
}
- /**
- * Figures out what file system we are writing output to. Here we use
- * outputBase instead of outputPath because we need a file system to create the latter.
- */
- private String determineOutputFileSystem() {
+ /** Returns the name of the file system we are writing output to. */
+ public String determineOutputFileSystem() {
+ // If we have a fancy OutputService, this may be different between consecutive Blaze commands
+ // and so we need to compute it freshly. Otherwise, we can used the immutable value that's
+ // precomputed by our BlazeWorkspace.
if (getOutputService() != null) {
- return getOutputService().getFilesSystemName();
- }
- try (AutoProfiler p = profiled("Finding output file system", ProfilerTask.INFO)) {
- return FileSystemUtils.getFileSystem(getOutputBase());
+ try (AutoProfiler p = profiled("Finding output file system", ProfilerTask.INFO)) {
+ return getOutputService().getFilesSystemName();
+ }
}
+ return workspace.getOutputBaseFilesystemTypeName();
}
}