-
Notifications
You must be signed in to change notification settings - Fork 46
/
jacoco.gradle
74 lines (66 loc) · 1.82 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
apply plugin: 'jacoco'
jacoco {
toolVersion libs.versions.jacoco.get().toString()
}
task jacocoAndroidTestReport(type: JacocoReport) {
sourceDirectories.from = files(["$project.projectDir/src/main/java"])
classDirectories.from = files([
fileTree(
dir: project.buildDir,
includes: [
"intermediates/javac/stableFullDebug/**",
"tmp/kotlin-classes/stableFullDebug/**"
],
excludes: [
'android/**/*.*',
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
// Dagger
'**/*Module.*',
'**/*Module*Factory.*',
'**/*Module$Companion.*',
'**/*Dependencies.class',
'**/*Dagger*.*',
'**/*MembersInjector*.*',
'**/*_Provide*Factory*.*',
'**/*_Factory.*',
// DBFlow
'**/*_Table*.*',
'**/*AppDatabaseAppDatabase_Database*.*',
'**/*GeneratedDatabaseHolder*.*',
// Butter Knife
'**/*_ViewBinding*',
]
)
])
executionData.from = fileTree(dir: project.buildDir, includes: [
'jacoco/**/*.exec',
'outputs/code_coverage/*/connected/*.ec'
])
if (project.hasProperty('codeCoverageDataLocation')) {
executionData.from += fileTree(dir: codeCoverageDataLocation, includes: ['**/*.ec'])
}
reports {
html {
enabled true
destination file("${buildDir}/reports/coverage")
}
xml {
enabled true
destination file("${buildDir}/reports/coverage.xml")
}
csv {
enabled false
}
}
doLast {
println "Wrote HTML coverage report to ${reports.html.destination}/index.html"
}
}
// Fix coverage for Robolectric tests
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}