Skip to content

Commit

Permalink
Only flatten nested sets when using path mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Feb 17, 2024
1 parent d758de1 commit edd47cb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -720,15 +720,17 @@ public NestedSet<Artifact> getPossibleInputsForTesting() {
*
* @param spawnResult the executor action that created the possibly stripped .jdeps output
* @param outputDepsProto path to the .jdeps output
* @param artifactsToPathMap all inputs to the current action plus any additional artifacts that
* may be referenced in the .jdeps file by path
* @param actionInputs all inputs to the current action
* @param additionalArtifactsForPathMapping any additional artifacts that may be referenced in the
* .jdeps file by path
* @param actionExecutionContext the action execution context
* @return the full deps proto (also written to disk to satisfy the action's declared output)
*/
static Deps.Dependencies createFullOutputDeps(
SpawnResult spawnResult,
Artifact outputDepsProto,
Iterable<Artifact> artifactsToPathMap,
NestedSet<Artifact> actionInputs,
NestedSet<Artifact> additionalArtifactsForPathMapping,
ActionExecutionContext actionExecutionContext,
PathMapper pathMapper)
throws IOException {
Expand All @@ -747,7 +749,8 @@ static Deps.Dependencies createFullOutputDeps(

// For each of the action's generated inputs, revert its mapped path back to its original path.
BiMap<String, PathFragment> mappedToOriginalPath = HashBiMap.create();
for (Artifact actionInput : artifactsToPathMap) {
for (Artifact actionInput :
Iterables.concat(actionInputs.toList(), additionalArtifactsForPathMapping.toList())) {
if (actionInput.isSourceArtifact()) {
continue;
}
Expand Down Expand Up @@ -831,7 +834,12 @@ private Deps.Dependencies readFullOutputDeps(
SpawnResult result = Iterables.getOnlyElement(results);
try {
return createFullOutputDeps(
result, outputDepsProto, getInputs().toList(), actionExecutionContext, pathMapper);
result,
outputDepsProto,
getInputs(),
getAdditionalArtifactsForPathMapping(),
actionExecutionContext,
pathMapper);
} catch (IOException e) {
throw ActionExecutionException.fromExecException(
new EnvironmentalExecException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ protected void afterExecute(
JavaCompileAction.createFullOutputDeps(
spawnResult,
outputDepsProto,
Iterables.concat(
getInputs().toList(), getAdditionalArtifactsForPathMapping().toList()),
getInputs(),
getAdditionalArtifactsForPathMapping(),
context,
pathMapper);
JavaCompileActionContext javaContext = context.getContext(JavaCompileActionContext.class);
Expand Down

0 comments on commit edd47cb

Please sign in to comment.