Am new to jacoco and in learning phase.
Am unable to exclude some packages which i don't want it under code coverage.
Using grade only.
Please find my jacoco.gradle file below. Am applying this jacoco.gradle file in build.gradle with apply from: 'jacoco.gradle'
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.7.6.201602180812"
}
android {
testOptions {
unitTests.all {
jacoco {
//includeNoLocationClasses = true
}
}
}
}
project.afterEvaluate {
android.applicationVariants.all { variant ->
def name = variant.name
def testTaskName = "test${name.capitalize()}UnitTest"
tasks.create(name: "${testTaskName}Coverage", type: JacocoReport, dependsOn: "$testTaskName") {
group = "Reporting"
description = "Generate Jacoco coverage reports for the ${name.capitalize()} build."
classDirectories = fileTree(
dir: "${project.buildDir}/intermediates/classes/${name}",
excludes: ['**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/ui/**', // -->would like to exclude this package and should not be considered.
'**/*$ViewBinder*.*',
'**/BuildConfig.*',
'**/Manifest*.*']
)
sourceDirectories = files(['src/main/java'].plus(android.sourceSets[name].java.srcDirs))
executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec")
reports {
xml.enabled = true
html.enabled = true
}
}
}
}
Tried with the options provided in google, no luck out of it.
Not only the specified package and would like to exclude other packages like interfaces, singleton and private methods too. Request you to please please help me in this regard.
Thanks and Regards,
Satya Prasad.