diff options
author | 2017-01-11 12:40:44 +0000 | |
---|---|---|
committer | 2017-01-11 16:02:02 +0000 | |
commit | bde853094f7de51b97bf11a51e5d77307cea28ec (patch) | |
tree | 503411410bb06e5640b3389cea29d09a90a5bc75 /src/main/java | |
parent | e31b3cf27c3fea50943da8e000b91573bb1ba452 (diff) |
Eliminate the $jacoco_runtime implicit attribute and link in the Jacoco agent through the $jacocorunner dependency.
They are either both linked in or neither of them is, so there isn't much point in separating them.
--
PiperOrigin-RevId: 144191570
MOS_MIGRATED_REVID=144191570
Diffstat (limited to 'src/main/java')
3 files changed, 0 insertions, 23 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaBinaryRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaBinaryRule.java index 2f758816f3..72b6146cac 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaBinaryRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaBinaryRule.java @@ -86,9 +86,6 @@ public final class BazelJavaBinaryRule implements RuleDefinition { } })) .add( - attr("$jacoco_runtime", LABEL) - .value(env.getToolsLabel("//tools/jdk:jacoco-blaze-agent"))) - .add( attr("$jacocorunner", LABEL).value(env.getToolsLabel( "//tools/jdk:JacocoCoverage"))) .build(); diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java index ecaf32e23e..6bb75dccdb 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java @@ -20,7 +20,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.Artifact; -import com.google.devtools.build.lib.analysis.FileProvider; import com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode; import com.google.devtools.build.lib.analysis.RuleConfiguredTargetBuilder; import com.google.devtools.build.lib.analysis.RuleContext; @@ -34,7 +33,6 @@ import com.google.devtools.build.lib.analysis.actions.TemplateExpansionAction.Su import com.google.devtools.build.lib.analysis.actions.TemplateExpansionAction.Template; import com.google.devtools.build.lib.analysis.config.BuildConfiguration; import com.google.devtools.build.lib.bazel.rules.BazelConfiguration; -import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.packages.BuildType; import com.google.devtools.build.lib.rules.java.DeployArchiveBuilder; @@ -54,7 +52,6 @@ import com.google.devtools.build.lib.rules.java.JavaUtil; import com.google.devtools.build.lib.rules.java.Jvm; import com.google.devtools.build.lib.rules.java.proto.GeneratedExtensionRegistryProvider; import com.google.devtools.build.lib.syntax.Type; -import com.google.devtools.build.lib.util.FileType; import com.google.devtools.build.lib.util.OS; import com.google.devtools.build.lib.util.Preconditions; import com.google.devtools.build.lib.util.ShellEscaper; @@ -479,19 +476,6 @@ public class BazelJavaSemantics implements JavaSemantics { + helper.getRuleContext().attributes().get("$jacocorunner", BuildType.LABEL) + " which is not a java_library rule, or contains errors"); } - // In offline instrumentation mode, add the Jacoco runtime to the classpath as well (this - // jar is not included by the coverage runner). Note that $jacoco is provided via a - // filegroup because the same jar can be used for online instrumentation, by simply adding - // it to -javaagent and -Xbootclasspath/p (similar to the Reverifier setup). The $jacoco jar - // has a "Premain-Class:" entry in its manifest, which would get erased by ijar filtering, - // hence the filegroup. - TransitiveInfoCollection agentTarget = - helper.getRuleContext().getPrerequisite("$jacoco_runtime", Mode.TARGET); - NestedSet<Artifact> filesToBuild = - agentTarget.getProvider(FileProvider.class).getFilesToBuild(); - for (Artifact jar : FileType.filter(filesToBuild, JavaSemantics.JAR)) { - attributes.addRuntimeClassPathEntry(jar); - } // We do not add the instrumented jar to the runtime classpath, but provide it in the shell // script via an environment variable. diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaTestRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaTestRule.java index aa228d3007..3696b2852e 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaTestRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaTestRule.java @@ -64,10 +64,6 @@ public final class BazelJavaTestRule implements RuleDefinition { .add( attr("$lcov_merger", LABEL) .value(env.getLabel("@bazel_tools//tools/test:LcovMerger_deploy.jar"))) - // Used in the one-per-build coverage report generation action. - .add( - attr("$jacoco_runtime", LABEL) - .value(env.getLabel("@bazel_tools//tools/jdk:jacoco-blaze-agent"))) .add( attr("$jacocorunner", LABEL) .value( |