Exclude the android folder from coverage

This commit is contained in:
Bradlee Speice 2014-11-17 15:36:42 -05:00
parent 66a91efe8b
commit 9aa83bebe2

View File

@ -16,10 +16,22 @@ dependencies {
testCompile 'org.robolectric:robolectric:+' testCompile 'org.robolectric:robolectric:+'
} }
jacocoTestReport { jacocoTestReport {
// Add Android sources/classes for coverage // Add Android sources/classes for coverage
additionalSourceDirs files(androidModule.android.sourceSets.main.java.srcDirs) // We can't use additionalClassDirs because of this:
additionalClassDirs firstVariant.javaCompile.outputs.files // http://stackoverflow.com/a/17411305/1454178
// Additionally, for whatever reason, the exclude() call doesn't work
// inside doFirst {}, please don't move this.
def jacocoExcludes = [
"android/**/*"
]
firstVariant.javaCompile.exclude(jacocoExcludes).outputs.files
doFirst {
sourceDirectories = files(androidModule.android.sourceSets.main.java.srcDirs)
classDirectories = firstVariant.javaCompile.outputs.files
}
reports { reports {
xml.enabled true xml.enabled true