Explicitly setup ActionFS file out err for input discovery. This is technically a bug in the non actionfs case, but it doesn't matter as much, since we've almost surely created the parent directories of the stdout/stderr.
PiperOrigin-RevId: 212292687
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
index 1c7bd0e..a34f685 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
@@ -660,6 +660,11 @@
clientEnv,
env,
actionFileSystem);
+ if (actionFileSystem != null) {
+ // Note that when not using ActionFS, a global setup of the parent directories of the OutErr
+ // streams is sufficient.
+ setupActionFsFileOutErr(actionExecutionContext.getFileOutErr(), action);
+ }
try {
actionExecutionContext.getEventBus().post(ActionStatusMessage.analysisStrategy(action));
return action.discoverInputs(actionExecutionContext);
@@ -863,6 +868,18 @@
return progressSupplier.getProgressString() + " " + message;
}
+ private static void setupActionFsFileOutErr(FileOutErr fileOutErr, Action action)
+ throws ActionExecutionException {
+ try {
+ fileOutErr.getOutputPath().getParentDirectory().createDirectoryAndParents();
+ fileOutErr.getErrorPath().getParentDirectory().createDirectoryAndParents();
+ } catch (IOException e) {
+ throw new ActionExecutionException(
+ "failed to create output directory for output streams'" + fileOutErr.getErrorPath() + "'",
+ e, action, false);
+ }
+ }
+
/**
* Prepare, schedule, execute, and then complete the action. When this function is called, we know
* that this action needs to be executed. This function will prepare for the action's execution
@@ -891,15 +908,7 @@
if (!usesActionFileSystem()) {
action.prepare(context.getFileSystem(), context.getExecRoot());
} else {
- try {
- context.getFileOutErr().getOutputPath().getParentDirectory().createDirectoryAndParents();
- context.getFileOutErr().getErrorPath().getParentDirectory().createDirectoryAndParents();
- } catch (IOException e) {
- throw new ActionExecutionException(
- "failed to create output directory for output streams'"
- + context.getFileOutErr().getErrorPath() + "'",
- e, action, false);
- }
+ setupActionFsFileOutErr(context.getFileOutErr(), action);
}
createOutputDirectories(action, context);
} catch (IOException e) {