aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java
index bc1aed908d..a428819d6e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaBinary.java
@@ -165,18 +165,22 @@ public class JavaBinary implements RuleConfiguredTargetFactory {
common.setJavaCompilationArtifacts(javaArtifactsBuilder.build());
+ Artifact manifestProtoOutput = helper.createManifestProtoOutput(classJar);
+
// The gensrc jar is created only if the target uses annotation processing. Otherwise,
// it is null, and the source jar action will not depend on the compile action.
- Artifact genSourceJar = helper.createGensrcJar(classJar);
- Artifact manifestProtoOutput = helper.createManifestProtoOutput(classJar);
+ Artifact genSourceJar = null;
+ Artifact genClassJar = null;
+ if (helper.usesAnnotationProcessing()) {
+ genClassJar = helper.createGenJar(classJar);
+ genSourceJar = helper.createGensrcJar(classJar);
+ helper.createGenJarAction(classJar, manifestProtoOutput, genClassJar);
+ }
helper.createCompileAction(
classJar, manifestProtoOutput, genSourceJar, outputDepsProto, instrumentationMetadata);
helper.createSourceJarAction(srcJar, genSourceJar);
- Artifact genClassJar = ruleContext.getImplicitOutputArtifact(JavaSemantics.JAVA_BINARY_GEN_JAR);
- helper.createGenJarAction(classJar, manifestProtoOutput, genClassJar);
-
common.setClassPathFragment(new ClasspathConfiguredFragment(
common.getJavaCompilationArtifacts(), attributes, false));