mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-21 15:38:35 -05:00
Exclude the android folder from coverage
This commit is contained in:
parent
9aa83bebe2
commit
5fbbf4ac13
@ -18,11 +18,16 @@ dependencies {
|
||||
|
||||
|
||||
jacocoTestReport {
|
||||
// Add Android sources/classes for coverage
|
||||
// We can't use additionalClassDirs because of this:
|
||||
// http://stackoverflow.com/a/17411305/1454178
|
||||
// Additionally, for whatever reason, the exclude() call doesn't work
|
||||
// inside doFirst {}, please don't move this.
|
||||
/*
|
||||
Alright, setting up Jacoco the right way is massively confusing.
|
||||
Normally, you'd use something like additionalClassDirs to add the folders you need.
|
||||
However, we want to exclude the android/ folder, and likely will need something else
|
||||
in the future. In order to do this though, we need the doFirst block. See SO here:
|
||||
http://stackoverflow.com/a/17411305/1454178
|
||||
|
||||
Additionally, to properly exclude, we need to run that code outside the doFirst block.
|
||||
No clue why this is, but please don't change this without extensive testing.
|
||||
*/
|
||||
def jacocoExcludes = [
|
||||
"android/**/*"
|
||||
]
|
||||
@ -33,12 +38,12 @@ jacocoTestReport {
|
||||
classDirectories = firstVariant.javaCompile.outputs.files
|
||||
}
|
||||
|
||||
// Back to your regularly scheduled Jacoco
|
||||
dependsOn test
|
||||
|
||||
reports {
|
||||
xml.enabled true
|
||||
csv.enabled false
|
||||
html.destination "${buildDir}/jacocoHtml"
|
||||
}
|
||||
}
|
||||
|
||||
// Code coverage should depend on the tests
|
||||
project.jacocoTestReport.dependsOn project.test
|
||||
|
Loading…
Reference in New Issue
Block a user