forked from ukhsa-collaboration/COVID-19-app-Android-BETA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jacoco.gradle
84 lines (71 loc) · 2.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
/*
* Copyright © 2020 NHSX. All rights reserved.
*/
def fileFilter = [
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'**/com/example/databinding/*',
'**/com/example/generated/callback/*',
'**/android/databinding/*',
'**/androidx/databinding/*',
'**/di/module/*',
'**/*MapperImpl*.*',
'**/*$ViewInjector*.*',
'**/*$ViewBinder*.*',
'**/BuildConfig.*',
'**/*Component*.*',
'**/*BR*.*',
'**/Manifest*.*',
'**/*$Lambda$*.*',
'**/*Companion*.*',
'**/*Module.*',
'**/*Dagger*.*',
'**/*MembersInjector*.*',
'**/*_Factory*.*',
'**/*_Provide*Factory*.*',
'**/*Extensions*.*',
'**/*$Result.*', /* filtering `sealed` and `data` classes */
'**/*$Result$*.*'/* filtering `sealed` and `data` classes */
]
apply plugin: "jacoco"
jacoco { toolVersion = "0.8.5" }
subprojects {
apply plugin: "jacoco"
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ["jdk.internal.*"]
}
}
project.evaluationDependsOnChildren()
project.afterEvaluate {
tasks.create(
name: "jacocoRootReport",
type: JacocoReport,
) {
def classDirs = []
def sourceDirs = []
def executions = []
subprojects.each { prj ->
mustRunAfter(prj.testDebugUnitTest)
mustRunAfter(prj.connectedAndroidTest)
classDirs += fileTree(dir: "$prj.buildDir/tmp/kotlin-classes/debug", excludes: fileFilter)
sourceDirs += files("$prj.projectDir/src/main/java")
executions += "$prj.buildDir/jacoco/testDebugUnitTest.exec"
fileTree("$prj.buildDir/outputs/code_coverage/debugAndroidTest/connected") {
include "**/*.ec"
}.files.each { file ->
executions += file.absolutePath
}
}
classDirectories.setFrom(files(classDirs))
additionalSourceDirs.setFrom(*sourceDirs)
sourceDirectories.setFrom(*sourceDirs)
executionData(*executions)
reports {
html.enabled = true
}
}
}