A Gradle plugin that adds fully configured JacocoReport
tasks for each Android application and library project variant.
The main purpose of this plugin is to automate the process of providing JacocoReport
tasks configuration to Android projects.
buildscript {
repositories {
...
maven { url 'https://dl.bintray.com/dicedmelon/maven' }
}
dependencies {
...
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'jacoco-android'
android {
...
productFlavors {
free {}
paid {}
}
}
jacocoAndroidUnitTestReport {
excludes = ['**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*']
}
This configuration will create a JacocoReport
task for each variant and an additional jacocoTestReport
task that runs all of them.
jacocoTestPaidDebugUnitTestReport
jacocoTestFreeDebugUnitTestReport
jacocoTestPaidReleaseUnitTestReport
jacocoTestFreeReleaseUnitTestReport
jacocoTestReport
To generate reports run:
$ ./gradlew jacocoTestReport