forked from getodk/collect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jacoco.gradle
55 lines (47 loc) · 1.85 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
apply plugin: 'jacoco'
jacoco {
// https://bintray.com/bintray/jcenter/org.jacoco:org.jacoco.core
toolVersion = '0.8.0'
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
task jacocoTestReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') {
description = 'Generate JaCoCo coverage reports'
doFirst {
files('build/intermediates/classes/debug').getFiles().each { file ->
if (file.name.contains('$$')) {
file.renameTo(file.path.replace('$$', '$'))
}
}
}
classDirectories = fileTree(
dir: "${buildDir}/intermediates/classes/debug",
excludes: ['**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/*$ViewBinder*.*',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*$Lambda$*.*', // Jacoco can not handle several "$" in class name.
'**/*$inlined$*.*', // Kotlin specific, Jacoco can not handle several "$" in class name.
'**/*Module.*', // Modules for Dagger.
'**/*Dagger*.*', // Dagger auto-generated code.
'**/*MembersInjector*.*', // Dagger auto-generated code.
'**/*_Provide*Factory*.*'] // Dagger auto-generated code.
)
def coverageSourceDirs = [
"${project.projectDir}/src/main/java",
"${project.projectDir}/src/debug/java"
]
additionalSourceDirs = files(coverageSourceDirs)
sourceDirectories = files(coverageSourceDirs)
executionData = fileTree(
dir: "$buildDir",
include: ["jacoco/testDebugUnitTest.exec", "outputs/code-coverage/connected/*coverage.ec"]
)
reports {
xml.enabled = true
html.enabled = true
}
}