-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
138 lines (113 loc) · 2.9 KB
/
build.gradle.kts
File metadata and controls
138 lines (113 loc) · 2.9 KB
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
plugins {
java
jacoco
application
id("com.diffplug.spotless") version "7.0.2"
}
group = "edu.luc.cs"
version = "0.3"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
dependencies {
// Apache Commons Collections
implementation("org.apache.commons:commons-collections4:4.5.0")
// JUnit Jupiter for testing
testImplementation("org.junit.jupiter:junit-jupiter:5.14.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// ArchUnit for architecture testing
testImplementation("com.tngtech.archunit:archunit-junit5:1.3.0")
}
application {
mainClass = "edu.luc.cs.stopwatch.Main"
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs.addAll(listOf("-Xlint:all"))
options.isDeprecation = true
}
tasks.test {
useJUnitPlatform()
// Enable assertions for tests
jvmArgs("-ea")
// Ensure JaCoCo report is generated after tests
finalizedBy(tasks.jacocoTestReport)
}
jacoco {
toolVersion = "0.8.14"
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
classDirectories.setFrom(
files(classDirectories.files.map {
fileTree(it) {
exclude(
"**/*Facade.class",
"**/common/*.class"
)
}
})
)
reports {
xml.required = true
html.required = true
}
}
tasks.jacocoTestCoverageVerification {
dependsOn(tasks.jacocoTestReport)
violationRules {
rule {
element = "BUNDLE"
limit {
counter = "INSTRUCTION"
value = "COVEREDRATIO"
minimum = "0.80".toBigDecimal()
}
limit {
counter = "METHOD"
value = "COVEREDRATIO"
minimum = "1.00".toBigDecimal()
}
limit {
counter = "LINE"
value = "COVEREDRATIO"
minimum = "0.90".toBigDecimal()
}
limit {
counter = "CLASS"
value = "COVEREDRATIO"
minimum = "1.00".toBigDecimal()
}
limit {
counter = "COMPLEXITY"
value = "COVEREDRATIO"
minimum = "1.00".toBigDecimal()
}
}
}
classDirectories.setFrom(
files(classDirectories.files.map {
fileTree(it) {
exclude(
"**/*Facade.class",
"**/common/*.class"
)
}
})
)
}
tasks.check {
dependsOn(tasks.jacocoTestCoverageVerification)
}
spotless {
java {
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
}