aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/test/InstrumentedFilesCollector.java
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2015-08-31 08:31:51 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2015-08-31 19:13:25 +0000
commit1d971c15941e91c585cf7c2124cff4e42bcdbd91 (patch)
treeded38e7e1e51f6eb8dacc11159f21bc3933ecbac /src/main/java/com/google/devtools/build/lib/rules/test/InstrumentedFilesCollector.java
parent30c6e9598367c7c35577d56422e6f00ccc9368bc (diff)
Merge the baseline coverage code path into the coverage codepath.
We're currently doing too much work for baseline coverage - every rule creates an action for its entire transitive closure; these actions are added to the output group for baseline coverage, but not transitively accumulated. It would be better for every rule to create an action for local baseline coverage, and to aggregate the baseline coverage artifacts down the dependency tree. By merging the code paths, the InstrumentedFilesCollector can perform the aggregation, because it can distinguish local and transitive files; I'm planning to implement that in a subsequent change. -- MOS_MIGRATED_REVID=101914334
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/test/InstrumentedFilesCollector.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/test/InstrumentedFilesCollector.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/test/InstrumentedFilesCollector.java b/src/main/java/com/google/devtools/build/lib/rules/test/InstrumentedFilesCollector.java
index 73f4cc1bc4..e636c8a449 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/test/InstrumentedFilesCollector.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/test/InstrumentedFilesCollector.java
@@ -41,10 +41,26 @@ import java.util.List;
public final class InstrumentedFilesCollector {
public static InstrumentedFilesProvider collect(RuleContext ruleContext, InstrumentationSpec spec,
LocalMetadataCollector localMetadataCollector, Iterable<Artifact> rootFiles) {
+ return collect(ruleContext, spec, localMetadataCollector, rootFiles, false);
+ }
+
+ public static InstrumentedFilesProvider collect(RuleContext ruleContext,
+ InstrumentationSpec spec, LocalMetadataCollector localMetadataCollector,
+ Iterable<Artifact> rootFiles, boolean withBaselineCoverage) {
InstrumentedFilesCollector collector = new InstrumentedFilesCollector(ruleContext, spec,
localMetadataCollector, rootFiles);
+ NestedSet<Artifact> baselineCoverageArtifacts;
+ if (withBaselineCoverage) {
+ baselineCoverageArtifacts =
+ BaselineCoverageAction.getBaselineCoverageArtifacts(ruleContext,
+ collector.instrumentedFiles);
+ } else {
+ baselineCoverageArtifacts = NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER);
+ }
return new InstrumentedFilesProviderImpl(collector.instrumentedFiles,
- collector.instrumentationMetadataFiles, ImmutableMap.<String, String>of());
+ collector.instrumentationMetadataFiles,
+ baselineCoverageArtifacts,
+ ImmutableMap.<String, String>of());
}
/**