Fix Action implementations to correctly propagate execution info.
SpawnAction and JavaCompileAction were using the un-merged local execution info, thus losing any from the parent class.
PiperOrigin-RevId: 420052074
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
index 7ade9af..5e8042a 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
@@ -363,6 +363,7 @@
throws CommandLineExpansionException, InterruptedException {
return new ActionSpawn(
commandLines.allArguments(),
+ this,
/*env=*/ ImmutableMap.of(),
/*envResolved=*/ false,
inputs,
@@ -401,6 +402,7 @@
commandLines.expand(artifactExpander, getPrimaryOutput().getExecPath(), commandLineLimits);
return new ActionSpawn(
ImmutableList.copyOf(expandedCommandLines.arguments()),
+ this,
env,
envResolved,
getInputs(),
@@ -558,7 +560,7 @@
}
/** A spawn instance that is tied to a specific SpawnAction. */
- private class ActionSpawn extends BaseSpawn {
+ private static class ActionSpawn extends BaseSpawn {
private final NestedSet<ActionInput> inputs;
private final Map<Artifact, ImmutableList<FilesetOutputSymlink>> filesetMappings;
private final ImmutableMap<String, String> effectiveEnvironment;
@@ -571,6 +573,7 @@
*/
private ActionSpawn(
ImmutableList<String> arguments,
+ SpawnAction parent,
Map<String, String> env,
boolean envResolved,
NestedSet<Artifact> inputs,
@@ -580,10 +583,10 @@
super(
arguments,
ImmutableMap.<String, String>of(),
- executionInfo,
- SpawnAction.this.getRunfilesSupplier(),
- SpawnAction.this,
- SpawnAction.this.resourceSetOrBuilder);
+ parent.getExecutionInfo(),
+ parent.getRunfilesSupplier(),
+ parent,
+ parent.resourceSetOrBuilder);
NestedSetBuilder<ActionInput> inputsBuilder = NestedSetBuilder.stableOrder();
ImmutableList<Artifact> manifests = getRunfilesSupplier().getManifests();
for (Artifact input : inputs.toList()) {
@@ -603,7 +606,7 @@
if (envResolved) {
effectiveEnvironment = ImmutableMap.copyOf(env);
} else {
- effectiveEnvironment = SpawnAction.this.getEffectiveEnvironment(env);
+ effectiveEnvironment = parent.getEffectiveEnvironment(env);
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
index 9d21384..240b09e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java
@@ -321,7 +321,7 @@
return new JavaSpawn(
expandedCommandLines,
getEffectiveEnvironment(actionExecutionContext.getClientEnv()),
- executionInfo,
+ getExecutionInfo(),
inputs);
}
@@ -336,7 +336,7 @@
return new JavaSpawn(
expandedCommandLines,
getEffectiveEnvironment(actionExecutionContext.getClientEnv()),
- executionInfo,
+ getExecutionInfo(),
NestedSetBuilder.<Artifact>stableOrder()
.addTransitive(mandatoryInputs)
.addTransitive(transitiveInputs)