-
Notifications
You must be signed in to change notification settings - Fork 1
/
jacoco.gradle
83 lines (78 loc) · 1.79 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
// read more: https://docs.gradle.org/current/userguide/jacoco_plugin.html
// Also got some thoughts from here: https://gist.github.com/aalmiray/e6f54aa4b3803be0bcac
allprojects {
apply plugin: 'jacoco'
jacoco {
toolVersion = '0.8.1'
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.5
}
}
rule {
enabled = false
element = 'CLASS'
includes = [
'org.gradle.*',
]
limit {
counter = 'LINE'
value = 'TOTALCOUNT'
maximum = 0.3
}
}
}
}
}
subprojects {
jacocoTestReport {
def main = sourceSets.main
def srcDirs = main.allSource.srcDirs
additionalSourceDirs = files(srcDirs)
sourceDirectories = files(srcDirs)
classDirectories = files(main.output)
reports {
xml.enabled = false
csv.enabled = false
html.enabled = true
html.destination file("$buildDir/jacoco/html")
}
}
}
jacocoTestReport {
def main = subprojects.sourceSets.main
def srcDirs = main.allSource.srcDirs
dependsOn = subprojects.check
additionalSourceDirs = files(srcDirs)
sourceDirectories = files(srcDirs)
classDirectories = files(main.output)
executionData = files(subprojects.jacocoTestReport.executionData)
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(
dir : it,
exclude: [
'*donot/check/me*',
'*dont/check/metoo*',
]
)
})
}
reports {
xml.enabled = false
csv.enabled = false
html.enabled = true
html.destination file("$rootProject.buildDir/jacoco/html")
}
onlyIf = {
true
}
doFirst {
executionData = files(executionData.findAll {
it.exists()
})
}
}