aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
diff options
context:
space:
mode:
authorGravatar Manuel Klimek <klimek@google.com>2015-08-10 15:58:04 +0000
committerGravatar Laszlo Csomor <laszlocsomor@google.com>2015-08-11 07:51:35 +0000
commit37eca0365bb790da7e9ed72482bdd742e0025c7a (patch)
tree44ad4695457a28159450d5ce6dbf0f4383b15a85 /src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
parentb8094c10861cabb00a3f0775dc804d3e059c49d5 (diff)
Convert the coverage flags to use the feature configuration.
-- MOS_MIGRATED_REVID=100281959
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
index f72c4f34c0..8d66f01753 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
@@ -784,6 +784,33 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
+ "}",
toolchainBuilder);
}
+ if (!features.contains("coverage")) {
+ TextFormat.merge(
+ ""
+ + "feature {"
+ + " name: 'coverage'"
+ + " flag_set {"
+ + " action: 'preprocess-assemble'"
+ + " action: 'c-compile'"
+ + " action: 'c++-compile'"
+ + " action: 'c++-header-parsing'"
+ + " action: 'c++-header-preprocessing'"
+ + " action: 'c++-module-compile'"
+ + " expand_if_all_available: 'gcov_gcno_file'"
+ + " flag_group {"
+ + " flag: '-fprofile-arcs'"
+ + " flag: '-ftest-coverage'"
+ + " }"
+ + " }"
+ + " flag_set {"
+ + " action: 'c++-link'"
+ + " flag_group {"
+ + " flag: '-lgcov'"
+ + " }"
+ + " }"
+ + "}",
+ toolchainBuilder);
+ }
} catch (ParseException e) {
// Can only happen if we change the proto definition without changing our configuration above.
throw new RuntimeException(e);