-
Notifications
You must be signed in to change notification settings - Fork 40
/
jacoco.gradle
53 lines (46 loc) · 1.48 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
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.8"
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
def androidExclusion = [
'**/databinding/**/*.*',
'**/android/databinding/*Binding.*',
'**/BR.*',
'**/R.*',
'**/R$*.*',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*_MembersInjector.*',
'**/Dagger*Component.*',
'**/Dagger*Component$Builder.*',
'**/*Module_*Factory.*',
'**/*Fragment*.*',
'**/*Activity*.*',
'**/*Adapter*.*',
'**/*ViewPager*.*',
'**/*ViewHolder*.*',
'**/*Module*.*'
]
task jacocoTestReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled = true
html.enabled = true
}
getClassDirectories().setFrom(fileTree(
dir: "${buildDir}/intermediates/javac/debug/classes/",
excludes: androidExclusion
))
println("debug -- buildDir: ${buildDir}")
println("debug -- project.projectDir: ${project.projectDir}")
getSourceDirectories().setFrom(files((project.projectDir).toString() + "/src"))
getExecutionData().setFrom(files("$buildDir/jacoco/testDebugUnitTest.exec"))
}
//task getCoverage(type: Exec, dependsOn: 'jacocoTestReport') {
// group = "Reporting"
// commandLine "open", "$buildDir/reports/jacoco/codeCoverageReport/html/index.html"
//}