-
Notifications
You must be signed in to change notification settings - Fork 2
/
jacoco.gradle
87 lines (76 loc) · 3.11 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
75
76
77
78
79
80
81
82
83
84
85
86
87
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.8"
reportsDirectory.set(file("$buildDir/reports/jacoco"))
}
task jacocoTestReport(type: JacocoReport) {
dependsOn = [
":ui:testDebugUnitTest",
":ui:createDebugCoverageReport",
":processor:test",
":generator:test",
":core:testDebugUnitTest"
]
group = "Reporting"
description = "Generate Jacoco coverage reports for both unit and instrumented unit tests"
reports {
csv.required = false
xml.required = true
html.required = true
xml.outputLocation = file("${jacoco.reportsDirectory}/jacocoTestReport.xml")
html.outputLocation = file("${jacoco.reportsDirectory}/html")
}
def includesFilter = [
'**/*Mapper*.*',
'**/*Presenter*.*',
'**/*ViewModel*.*'
]
def excludesFilter = [
'**/*Test*.*',
'**/AutoValue_*.*',
'**/*JavascriptBridge.class',
'**/R.class',
'**/R$*.class',
'**/Manifest*.*',
'android/**/*.*',
'**/BuildConfig.*',
'**/*$ViewBinder*.*',
'**/*$ViewInjector*.*',
'**/Lambda$*.class',
'**/Lambda.class',
'**/*Lambda.class',
'**/*Lambda*.class',
'**/lambda$*.class',
'**/lambda.class',
'**/*lambda.class',
'**/*lambda*.class',
'**/*$$special$$inlined$inject$*.*',
'**/*$InjectAdapter.class',
'**/*$ModuleAdapter.class',
'**/*$ViewInjector*.class',
'**/*_MembersInjector.class', //Dagger2 generated code
'*/*_MembersInjector*.*', //Dagger2 generated code
'**/*_*Factory*.*', //Dagger2 generated code
'*/*Component*.*', //Dagger2 generated code
'**/*Module*.*' //Dagger2 generated code
]
def sourcesTree = [
"./ui/src/main/kotlin",
"./core/src/main/kotlin",
"./processor/src/main/kotlin",
"./generator/src/main/kotlin"
]
def debugTree = fileTree(dir: "./ui/build/intermediates/classes/debug", excludes: excludesFilter) +
fileTree(dir: "./ui/build/tmp/kotlin-classes/debug", excludes: excludesFilter) +
fileTree(dir: "./processor/build/classes/kotlin/main", excludes: excludesFilter) +
fileTree(dir: "./generator/build/classes/kotlin/main", excludes: excludesFilter) +
fileTree(dir: "./core/build/intermediates/classes/debug", excludes: excludesFilter) +
fileTree(dir: "./core/build/tmp/kotlin-classes/debug", excludes: excludesFilter)
def executionTree = fileTree(dir: "./ui/build", includes: ["jacoco/testDebugUnitTest.exec", "outputs/code_coverage/debugAndroidTest/connected/*coverage.ec"]) +
fileTree(dir: "./processor/build", includes: ["jacoco/test.exec"]) +
fileTree(dir: "./generator/build", includes: ["jacoco/test.exec"]) +
fileTree(dir: "./core/build", includes: ["jacoco/testDebugUnitTest.exec", "outputs/code_coverage/debugAndroidTest/connected/*coverage.ec"])
getSourceDirectories().setFrom(files(sourcesTree))
getClassDirectories().setFrom(files([debugTree]))
getExecutionData().setFrom(files([executionTree]))
}