aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2018-06-15 17:33:57 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-15 17:35:34 -0700
commitc6b852ec0df08ddd1bc542e6f0a78c1cc71c62e8 (patch)
treee5da89aa1e399fb0a48e5a8877814f2be3d61832 /src/main/java/com/google/devtools/build/lib/rules
parent24e8f297ed7402377cfae6c9f7a1620dd62b4208 (diff)
Allow CppCompilationHelper to disable coverage instrumentation
RELNOTES=None PiperOrigin-RevId: 200800112
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java
index e5f0191a3a..30d0949419 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java
@@ -231,6 +231,7 @@ public final class CcCompilationHelper {
private String purpose = null;
private boolean generateNoPicAction;
private boolean generatePicAction;
+ private boolean allowCoverageInstrumentation = true;
// TODO(plf): Pull out of class.
private CcCompilationContext ccCompilationContext;
@@ -710,6 +711,10 @@ public final class CcCompilationHelper {
return this;
}
+ public void setAllowCoverageInstrumentation(boolean allowCoverageInstrumentation) {
+ this.allowCoverageInstrumentation = allowCoverageInstrumentation;
+ }
+
/**
* Create the C++ compile actions, and the corresponding compilation related providers.
*
@@ -1935,7 +1940,10 @@ public final class CcCompilationHelper {
}
/** Returns true iff code coverage is enabled for the given target. */
- private boolean isCodeCoverageEnabled() {
+ public boolean isCodeCoverageEnabled() {
+ if (!allowCoverageInstrumentation) {
+ return false;
+ }
if (configuration.isCodeCoverageEnabled()) {
// If rule is matched by the instrumentation filter, enable instrumentation
if (InstrumentedFilesCollector.shouldIncludeLocalSources(ruleContext)) {