-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
145 lines (121 loc) · 4.1 KB
/
build.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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
plugins {
kotlin("jvm") version "1.9.20"
kotlin("kapt") version "1.6.21"
kotlin("plugin.spring") version "1.9.20" apply false
kotlin("plugin.jpa") version "1.9.20" apply false
id("org.springframework.boot") version "3.2.0" apply false
id("io.spring.dependency-management") version "1.1.4" apply false
jacoco
}
java.sourceCompatibility = JavaVersion.VERSION_17
allprojects {
group = "com.whatever"
version = "0.0.1-SNAPSHOT"
repositories {
mavenCentral()
}
}
subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "kotlin-kapt")
apply(plugin = "org.jetbrains.kotlin.plugin.spring")
apply(plugin = "org.springframework.boot")
apply(plugin = "jacoco")
apply(plugin = "io.spring.dependency-management")
dependencies {
implementation("org.springframework.boot:spring-boot-starter")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("io.github.microutils:kotlin-logging:2.0.8")
implementation("org.jetbrains.kotlin:kotlin-reflect")
// SpringMockk
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("com.ninja-squad:springmockk:3.1.1")
}
jacoco {
toolVersion = "0.8.11"
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
reports {
html.required = true
html.outputLocation = layout.buildDirectory.dir("reports/test-coverage.html").get().asFile
csv.required = false
xml.required = false
}
val excludes = listOf(
"com/whatever/raisedragon/config",
"com/whatever/raisedragon/common",
"com/whatever/raisedragon/infra",
"com/whatever/raisedragon/common/config",
"com/whatever/raisedragon/aws",
"com/whatever/raisedragon/applicationservice/*/dto"
)
classDirectories.setFrom(
sourceSets.main.get().output.asFileTree.matching {
exclude(excludes)
}
)
finalizedBy(tasks.jacocoTestCoverageVerification)
}
tasks.jacocoTestCoverageVerification {
val qDomains = mutableListOf<String>()
for (qPattern in 'A'..'Z') {
qDomains.add("*.Q${qPattern}*")
}
violationRules {
rule {
enabled = true
element = "CLASS"
limit {
counter = "BRANCH"
value = "COVEREDRATIO"
// TODO Fix minimum ratio after increasing test coverage ratio
minimum = "0.00".toBigDecimal()
}
limit {
counter = "LINE"
value = "TOTALCOUNT"
maximum = "200".toBigDecimal()
// TODO Fix minimum ratio after increasing test coverage ratio
minimum = "0.00".toBigDecimal()
}
excludes = qDomains
}
}
val excludes = listOf(
"com/whatever/raisedragon/config",
"com/whatever/raisedragon/common",
"com/whatever/raisedragon/infra",
"com/whatever/raisedragon/common/config",
"com/whatever/raisedragon/aws",
"com/whatever/raisedragon/applicationservice/*/dto"
)
classDirectories.setFrom(
sourceSets.main.get().output.asFileTree.matching {
exclude(excludes)
}
)
}
tasks.test {
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport)
}
tasks.compileKotlin {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
}
}
tasks.compileTestKotlin {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
}
}
tasks.getByName("bootJar") {
enabled = false
}
tasks.getByName("jar") {
enabled = true
}
}