-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathjacoco.gradle
26 lines (22 loc) · 1.03 KB
/
jacoco.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
apply plugin: 'jacoco'
task jacocoReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') {
reports {
csv { enabled false } // change if needed
xml { enabled true } // change if needed
html {
enabled true
destination file("${buildDir}/coverage-report")
}
}
// Setup the .class, source, and execution directories
final fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', 'android/**/*.*']
// Include this if you use Kotlin
final kotlinTree = fileTree(dir: "${project.buildDir}/tmp/kotlin-classes/debug", excludes: fileFilter)
final javacTree = fileTree(dir: "${project.buildDir}/intermediates/javac/debug", excludes: fileFilter)
final mainSrc = "${project.projectDir}/src/main/java"
sourceDirectories.setFrom files([mainSrc])
classDirectories.setFrom files([kotlinTree, javacTree])
executionData.setFrom fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec'
])
}