aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/test/CoverageReportActionFactory.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-02-11 00:18:07 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-02-11 00:18:07 +0000
commitcdc90e9279fdd127720cb0bf8548ce3e1b4f6042 (patch)
treea6796726dbe7c59a36ed38f548c2824adeed03ef /src/main/java/com/google/devtools/build/lib/rules/test/CoverageReportActionFactory.java
parenta242f210e6584a4fbe2b29e2ca42e94dbb843552 (diff)
As a follow up to []. This changelist creates an intermediary FileWriteAction to store the list of lcov files in a file before calling the code coverage report binary.
Cleanup on the COVERAGE_REPORT to support multiple actions. RELNOTES: HTML code coverage report fix for large targets. -- MOS_MIGRATED_REVID=86033675
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/test/CoverageReportActionFactory.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/test/CoverageReportActionFactory.java43
1 files changed, 38 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/test/CoverageReportActionFactory.java b/src/main/java/com/google/devtools/build/lib/rules/test/CoverageReportActionFactory.java
index c3f5788a64..9354d4340b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/test/CoverageReportActionFactory.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/test/CoverageReportActionFactory.java
@@ -14,6 +14,8 @@
package com.google.devtools.build.lib.rules.test;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.actions.Action;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactFactory;
@@ -31,12 +33,43 @@ import javax.annotation.Nullable;
public interface CoverageReportActionFactory {
/**
- * Returns a coverage report Action. May return null if it's not necessary to create
- * such an Action based on the input parameters and some other data available to
- * the factory implementation, such as command line arguments.
+ * Wraps the necessary actions to get a coverage report as well as the final
+ * output artifacts.
+ * The lcovWriteAction creates a file containing a set of lcov files.
+ * This file is used as an input artifact for coverageReportAction.
+ * We are only interested about the output artifacts from
+ * coverageReportAction.
*/
+
+ public static final class CoverageReportActionsWrapper {
+ private final Action lcovWriteAction;
+ private final Action coverageReportAction;
+
+ public CoverageReportActionsWrapper (
+ Action lcovWriteAction, Action coverageReportAction) {
+ this.lcovWriteAction = lcovWriteAction;
+ this.coverageReportAction = coverageReportAction;
+ }
+
+ public ImmutableList<Action> getActions() {
+ return ImmutableList.of(lcovWriteAction, coverageReportAction);
+ }
+
+ public ImmutableSet<Artifact> getCoverageOutputs() {
+ return coverageReportAction.getOutputs();
+ }
+ }
+
+ /**
+ * Returns a CoverageReportActionsWrapper. May return null if
+ * it's not necessary to create such Actions based on the input parameters
+ * and some other data available to the factory implementation, such as
+ * command line arguments.
+ */
+
@Nullable
- public Action createCoverageReportAction(Collection<ConfiguredTarget> targetsToTest,
+ public CoverageReportActionsWrapper createCoverageReportActionsWrapper(
+ Collection<ConfiguredTarget> targetsToTest,
Set<Artifact> baselineCoverageArtifacts,
ArtifactFactory artifactFactory, ArtifactOwner artifactOwner);
-} \ No newline at end of file
+}