Skip to content

Commit

Permalink
Do not rewrite .jdeps file when it is empty.
Browse files Browse the repository at this point in the history
`JavaCompileAction` rewrites the `.jdeps` files after running the spawn if path stripping was used. The code skips the rewrite if there is [any unstripped path in the file](https://github.com/bazelbuild/bazel/blob/6142eac9153b539661c43dada5e11b552a6f58f6/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java#L699-L703). This will not happen if the jdeps file is empty.

Skip rewriting the `.jdeps` file if there are no paths in it.

PiperOrigin-RevId: 447475281
  • Loading branch information
alexjski authored and copybara-github committed May 9, 2022
1 parent 280ef69 commit b9da390
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,11 @@ static Deps.Dependencies createFullOutputDeps(
}
}

// No paths to rewrite.
if (executorJdeps.getDependencyCount() == 0) {
return executorJdeps;
}

// Rewrite the .jdeps proto with full paths.
Deps.Dependencies.Builder fullDepsBuilder = Deps.Dependencies.newBuilder(executorJdeps);
for (Deps.Dependency.Builder dep : fullDepsBuilder.getDependencyBuilderList()) {
Expand Down

0 comments on commit b9da390

Please sign in to comment.