-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
67 lines (54 loc) · 1.54 KB
/
build.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
plugins {
id 'java'
id 'jacoco'
}
test {
finalizedBy jacocoTestReport
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.enabled true
}
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
jar {
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
task coverageReport {
doLast {
def slurper = new XmlSlurper()
slurper.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false)
slurper.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
def missed = 0.0
def covered = 0.0
def xml = slurper.parse(projectDir.toString() + "/build/reports/jacoco/test/jacocoTestReport.xml")
def counter = xml.counter.find {
node -> node.@type == 'INSTRUCTION'
}
missed += [email protected]()
covered += [email protected]()
def total = missed + covered
def percentage = covered / total * 100
printf "Missed %.0f instructions%n", missed
printf "Covered %.0f instructions%n", covered
printf "Total %.2f%%%n", percentage
}
}
ext {
vertx = '4.0.2'
jackson = '2.12.2'
mockito = '3.8.0'
}
dependencies {
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "$jackson"
testCompile group: 'org.mockito', name: 'mockito-core', version: "$mockito"
testCompile group: 'junit', name: 'junit', version: '4.12'
}