-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-quality.gradle.kts
49 lines (42 loc) · 1.27 KB
/
build-quality.gradle.kts
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
tasks.withType<JacocoReport> {
reports {
xml.isEnabled = false
csv.isEnabled = false
html.destination = file("${buildDir}/jacocoHtml")
}
}
tasks.withType<JacocoCoverageVerification> {
violationRules {
rule {
element = "BUNDLE"
limit {
counter = "LINE"
value = "COVEREDRATIO"
minimum = "0.9".toBigDecimal()
}
}
}
}
// JacocoReport -> JacocoVerify -> build
// first we need to generate report, then fail
tasks.named("build").configure {
dependsOn(tasks.withType<JacocoCoverageVerification>())
}
tasks.withType<JacocoCoverageVerification> {
dependsOn(tasks.withType<JacocoReport>())
}
tasks.withType<Checkstyle> {
// based on google checks, relaxed a bit (+spaces indent)
configFile = file("${rootDir}/quality/checkstyle.xml")
}
tasks.withType<Pmd> {
isConsoleOutput = true
ruleSets = emptyList<String>()
ruleSetConfig = resources.text.fromFile("quality/pmd.xml")
}
// run PMD just on main
extensions.getByType(PmdExtension::class.java).sourceSets = mutableListOf(the<SourceSetContainer>()["main"])
tasks.withType<Test> {
useJUnitPlatform()
systemProperty("file.encoding", "UTF-8") // force encoding for default streams
}