-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
137 lines (109 loc) · 3.35 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
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
plugins {
id 'java'
id 'jacoco'
id 'org.springframework.boot' version '3.3.4' apply(false)
id 'io.spring.dependency-management' version '1.1.6' apply(false)
}
ext {
set('springCloudVersion', "2023.0.3")
}
allprojects {
group = 'radiata'
version = '0.0.1-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'jacoco'
repositories {
mavenCentral()
}
test {
useJUnitPlatform()
finalizedBy 'jacocoTestReport' // test 끝나면 jacocoTestReport 동작
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
setJacoco()
}
subprojects {
if (isDirectory()) {
return
}
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
bootJar.enabled = false
dependencies {
/* module */
/* library */
// spring
implementation 'org.springframework.boot:spring-boot-starter'
// validation
implementation 'org.springframework.boot:spring-boot-starter-validation'
// lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
// prometheus
implementation 'org.springframework.boot:spring-boot-starter-actuator'
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
/* test */
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
}
def isDirectory() {
def directoryModules = ['service', 'order', 'payment', 'user']
return directoryModules.contains(project.name)
}
def setJacoco() {
// jacoco report 설정
jacocoTestReport {
reports {
// 리포트 타입마다 리포트 저장 경로를 설정할 수 있습니다.
html.destination file("jacoco/report")
}
// QueryDsl Q class 제외
def Qdomains = []
for (qPattern in '**/QA'..'**/QZ') {
Qdomains.add(qPattern + '*')
}
// 커버리지 보고서 제외 범위 설정
getClassDirectories().setFrom(
files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**/*Application*",
"**/*Config*",
"**/dto",
"**/*Exception*"
] + Qdomains)
})
)
// jacocoTestReport 끝나면 jacocoTestCoverageVerification 동작
finalizedBy 'jacocoTestCoverageVerification'
}
// jacoco 커버리지 검증 설정
jacocoTestCoverageVerification {
def Qdomains = []
for (qPattern in '*.QA'..'*.QZ') {
Qdomains.add(qPattern + '*')
}
violationRules {
rule {
enabled = true // 커버리지 적용 여부
element = 'CLASS' // 커버리지 적용 단위
excludes = [
"**/*Application*",
"**/*Config*",
"**/dto",
"**/*Exception*"
] + Qdomains
}
}
}
}