-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
146 lines (128 loc) · 4.27 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
138
139
140
141
142
143
144
145
146
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.0'
id 'io.spring.dependency-management' version '1.1.5'
id "org.asciidoctor.jvm.convert" version "3.3.2" // (1)
id 'jacoco'
id "org.sonarqube" version "4.4.1.3373"
}
group = 'sample'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
asciidoctorExt // (2)
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'org.springframework.boot:spring-boot-starter-validation'
runtimeOnly 'com.mysql:mysql-connector-j'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.apache.commons:commons-lang3:3.9'
// Redis
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.redisson:redisson-spring-boot-starter:3.32.0'
// MapStruct
implementation 'org.mapstruct:mapstruct:1.5.3.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final'
annotationProcessor(
'org.projectlombok:lombok',
'org.projectlombok:lombok-mapstruct-binding:0.1.0'
)
// Rest docs
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor' // (3)
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc' // (4)
}
ext {
snippetsDir = file('build/generated-snippets') // (5)
}
tasks.named('test') {
useJUnitPlatform()
finalizedBy jacocoTestReport // 테스트 실행 후 항상 report가 생성됩니다.
outputs.dir snippetsDir // (6)
}
//jacoco start
private excludedClassFilesForReport(classDirectories) {
classDirectories.setFrom(
files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**/Q*",
"**/*Application*",
"**/*Config*",
"**/*Response*",
"**/*Request*",
"**/exception/**",
"**/Mock**",
"**/aspect/**",
"**/scheduler/**"
])
})
)
}
asciidoctor {
configurations 'asciidoctorExt' // (7)
baseDirFollowsSourceFile() // (8)
inputs.dir snippetsDir // (9)
dependsOn test // (10)
}
asciidoctor.doFirst {
delete file('src/main/resources/static/docs') // (11)
}
task copyDocument(type: Copy) { // (12)
dependsOn asciidoctor
from file("build/docs/asciidoc")
into file("src/main/resources/static/docs")
}
build {
dependsOn copyDocument
}
jacoco {
toolVersion = "0.8.9"
}
jacocoTestReport {
dependsOn test // report를 생성하기 전에 테스트를 실행해야합니다.
reports {
xml.required = true
csv.required = false
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
}
excludedClassFilesForReport(classDirectories)
finalizedBy jacocoTestCoverageVerification // 테스트 실행 후 항상 테스트 커버리지 검증을 실행합니다.
}
jacocoTestCoverageVerification { // 코드 커버리지를 검증합니다. 규칙을 만족하지 못하면 빌드는 실패합니다.
excludedClassFilesForReport(classDirectories)
// violationRules {
// rule { // 규칙을 지정합니다.
// enabled = true
// element = 'CLASS' // 클래스 단위로 규칙을 체크합니다.
//
//// // 브랜치 커버리지를 최소 70% 만족시켜야 합니다.
//// limit {
//// counter = 'BRANCH'
//// value = 'COVEREDRATIO'
//// minimum = 0.70
//// }
//
// // 라인 커버리지를 최소 70% 만족시켜야 합니다.
// limit {
// counter = 'LINE'
// value = 'COVEREDRATIO'
// minimum = 0.70
// }
// }
// }
}
//jacoco end