Generate .jdeps file for the main .jar file and not for the -class.jar file. RELNOTES: None PiperOrigin-RevId: 235245103
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java index 252d1ca..0cd26fb 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java
@@ -191,8 +191,6 @@ * @param manifestProtoOutput the output artifact for the manifest proto emitted from JavaBuilder * @param gensrcOutputJar the generated sources jar Artifact to create with the Action (null if no * sources will be generated). - * @param outputDepsProto the compiler-generated jdeps file to create with the Action (null if not - * requested) * @param instrumentationMetadataJar metadata file (null if no instrumentation is needed or if * --experimental_java_coverage is true). * @param nativeHeaderOutput an archive of generated native header files. @@ -241,7 +239,7 @@ builder.setNativeHeaderOutput(nativeHeaderOutput); builder.setManifestProtoOutput(manifestProtoOutput); builder.setGensrcOutputJar(gensrcOutputJar); - builder.setOutputDepsProto(getOutputDepsProtoPath(classJar)); + builder.setOutputDepsProto(getOutputDepsProtoPath(outputJar)); builder.setAdditionalOutputs(attributes.getAdditionalOutputs()); builder.setMetadata(instrumentationMetadataJar); builder.setInstrumentationJars(jacocoInstrumentation);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilder.java index e6b64cc..e1f4562 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilder.java
@@ -301,7 +301,8 @@ } else { Artifact outputDepsProtoArtifact = ruleContext.getDerivedArtifact( - FileSystemUtils.replaceExtension(outputJar.getRootRelativePath(), ".jdeps"), + FileSystemUtils.replaceExtension( + outputDepsProto.relativeTo(outputJar.getRoot().getExecPath()), ".jdeps"), outputJar.getRoot()); outputDepsProtoInput = outputDepsProtoArtifact; outputs.add(outputDepsProtoArtifact);