Enable code coverage with a flag
An experiment shows that running tests with code coverage enabled has
an impact on the overall time spent to run these tests (32min with code
coverage enabled, 22min without).
This CL adds a flag (--with_code_coverage) to enable code coverage
with Jacoco only when desired. It allows to save time on build bots.
When this flag is passed to the tools/test.py script, it will set the
corresponding Gradle flag (which applies the Jacoco plugin) and add
the gralde task 'jacocoTestReport' as well so that a code coverage
report gets generated after the tests.
Change-Id: Ic3cb3463d42700a1a178e43834c3fdd5499fa9d0
diff --git a/build.gradle b/build.gradle
index 58b0aaf..1d9a782 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,11 +6,15 @@
apply plugin: 'java'
apply plugin: 'idea'
-apply plugin: 'jacoco'
apply plugin: 'com.google.protobuf'
apply from: 'copyAdditionalJctfCommonFiles.gradle'
+
+if (project.hasProperty('with_code_coverage')) {
+ apply plugin: 'jacoco'
+}
+
repositories {
mavenCentral()
}