aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar elenairina <elenairina@google.com>2017-12-12 05:03:01 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-12-12 05:04:55 -0800
commit03964c8ccb20d673add76c7f37245e837c3899b6 (patch)
tree95717ba052b66975414c42f0056383b93588b3a9 /src/main/java/com/google/devtools/build/lib/rules
parent4f5a92b78ac23adcf23128eef51b99f6147f1027 (diff)
[java_common.compile] Name output source jar relative to the output jar name
instead of the rule name. RELNOTES: None. PiperOrigin-RevId: 178747070
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/java/JavaSkylarkCommon.java8
2 files changed, 5 insertions, 5 deletions
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 75877350ac..0e09320c5f 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
@@ -882,7 +882,7 @@ public final class JavaCompilationHelper {
* prefix and removing the extension and replacing it by the given suffix.
* The new artifact will have the same root as the given one.
*/
- private static Artifact derivedArtifact(
+ static Artifact derivedArtifact(
RuleContext ruleContext, Artifact artifact, String prefix, String suffix) {
PathFragment path = artifact.getRootRelativePath();
String basename = FileSystemUtils.removeExtension(path.getBaseName()) + suffix;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaSkylarkCommon.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaSkylarkCommon.java
index 36a876c78c..d9d14a4eed 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaSkylarkCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaSkylarkCommon.java
@@ -434,7 +434,7 @@ public class JavaSkylarkCommon {
boolean generateMergedSourceJar = (sourceJars.size() > 1 || !sourceFiles.isEmpty())
|| (sourceJars.isEmpty() && sourceFiles.isEmpty() && !exports.isEmpty());
Artifact outputSourceJar =
- generateMergedSourceJar ? getSourceJar(skylarkRuleContext) : sourceJars.get(0);
+ generateMergedSourceJar ? getSourceJar(skylarkRuleContext, outputJar) : sourceJars.get(0);
JavaCompilationArtifacts artifacts =
helper.build(
@@ -481,9 +481,9 @@ public class JavaSkylarkCommon {
.build();
}
- private static Artifact getSourceJar(SkylarkRuleContext skylarkRuleContext) throws EvalException {
- return skylarkRuleContext.getRuleContext()
- .getBinArtifact("lib" + skylarkRuleContext.getLabel().getName() + "-src.jar");
+ private static Artifact getSourceJar(SkylarkRuleContext skylarkRuleContext, Artifact outputJar) {
+ return JavaCompilationHelper.derivedArtifact(
+ skylarkRuleContext.getRuleContext(), outputJar, "", "-src.jar");
}
private static Artifact buildIjar(