-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
318 lines (260 loc) Β· 8.76 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
buildscript {
ext {
queryDslVersion = "5.0.0"
}
}
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.8'
id 'io.spring.dependency-management' version '1.1.0'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10'
id 'jacoco'
id 'com.epages.restdocs-api-spec' version '0.16.4'
}
group = 'com.dadok'
version = '0.9.9'
sourceCompatibility = '17'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
asciidoctorExt
}
repositories {
mavenCentral()
}
ext {
set('snippetsDir', file("build/generated-snippets"))
}
jacoco {
toolVersion = '0.8.8'
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.0'
// Apache Commons Lang
implementation 'org.apache.commons:commons-lang3:3.0'
implementation 'commons-validator:commons-validator:1.7'
// p6spy
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.8.1'
// mapstruct
implementation 'org.mapstruct:mapstruct:1.5.3.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final'
// jwt
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'
// QueryDSL
implementation "com.querydsl:querydsl-jpa:${queryDslVersion}"
implementation "com.querydsl:querydsl-apt:${queryDslVersion}"
//oauth
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
// slack
implementation 'com.slack.api:slack-api-client:1.27.3'
compileOnly 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
testImplementation 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
// lombok- mapstruct binding
annotationProcessor 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
testAnnotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation group: 'org.mockito', name: 'mockito-inline', version: '4.9.0'
// javax.annotation.meta.When runtimeμ μ μ©
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'com.google.guava:guava:31.1-jre'
// https://mvnrepository.com/artifact/commons-io/commons-io
implementation 'commons-io:commons-io:2.11.0'
testImplementation 'com.epages:restdocs-api-spec:0.16.4'
testImplementation 'com.epages:restdocs-api-spec-mockmvc:0.16.4'
}
def excludesValues = [
"com/dadok/gaerval/global/*",
"**/*Properties.class",
"**/*Exception.class",
"**/request/*",
"**/exception/*",
"**/response/*",
"com.dadok.gaerval.DadokApplication.class"
]
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
def Qdomains = []
for (qPattern in "**/QA".."**/QZ") {
Qdomains.add(qPattern + "*")
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it,
excludes: excludesValues + Qdomains) // μ μΈν Qdomains ν¨ν΄ μΆκ°
}))
}
reports {
xml.enabled true
csv.enabled false
html.enabled true
html.destination file("${buildDir}/jacoco/test_report")
xml.destination file("${buildDir}/jacoco/test_report/test_report.xml")
}
}
jacocoTestCoverageVerification {
def Qdomains = []
for (qPattern in "*.QA".."*.QZ") {
Qdomains.add(qPattern + "*")
}
violationRules {
rule {
enabled = true
element = 'CLASS'
// include = []
limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 0.80
}
excludes = excludesValues + Qdomains
}
}
}
// ---- querydsl μ€μ
// querydsl μ¬μ©ν κ²½λ‘ μ§μ . νμ¬ μ§μ ν λΆλΆμ .gitignore μ ν¬ν¨λλ―λ‘ git μ μ¬λΌκ°μ§ μλλ€.
def querydslDir = "$buildDir/generated/'querydsl'"
querydsl { // JPA μ¬μ©μ¬λΆ λ° μ¬μ© κ²½λ‘ μ€μ
jpa = true
querydslSourcesDir = querydslDir
}
sourceSets { // buildμ μ¬μ©ν sourceSet μΆκ° μ€μ
main.java.srcDir querydslDir
}
compileQuerydsl { // querydsl μ»΄νμΌ μ μ¬μ©ν μ΅μ
μ€μ
options.annotationProcessorPath = configurations.querydsl
}
// querydslμ΄ compileClassPathλ₯Ό μμνλλ‘ μ€μ
configurations {
compileOnly {
extendsFrom annotationProcessor
}
querydsl.extendsFrom compileClasspath
}
compileQuerydsl.doFirst {
if (file(querydslDir).exists()) delete(file(querydslDir))
}
compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
}
// gradle clean μμ QClass λλ ν 리 μμ
clean {
delete file(querydslDir)
delete file("$buildDir/resources/main/static/docs")
println('-------------------------------------------------------')
println('clean do remove docs')
delete file('src/main/resources/static/docs')
println('-------------------------------------------------------')
println()
}
// ---- querydsl
test {
useJUnitPlatform()
outputs.dir snippetsDir
finalizedBy 'jacocoTestReport'
def Qdomains = []
for (qPattern in "*.QA".."*.QZ") {
Qdomains.add(qPattern + "*")
}
jacoco {
excludes += excludesValues + Qdomains
}
}
tasks.named('test') {
outputs.dir snippetsDir
useJUnitPlatform()
}
tasks.named('asciidoctor') {
inputs.dir snippetsDir
dependsOn test
}
asciidoctor.doFirst {
println('-------------------------------------------------------')
println('do first remove docs')
delete file('src/main/resources/static/docs')
println('-------------------------------------------------------')
println()
}
asciidoctor {
dependsOn test
inputs.dir snippetsDir
configurations 'asciidoctorExt'
sources {
include("**/index.adoc", "**/common/*.adoc")
}
baseDirFollowsSourceFile()
}
task copyDocument(type: Copy) {
dependsOn asciidoctor
println('-------------------------------------------------------')
println('copy document')
from file("build/docs/asciidoc")
into file("src/main/resources/static/docs")
println('-------------------------------------------------------')
println()
}
openapi3 {
servers = [
{ url = 'http://localhost:8080' },
]
title = 'Dadok API Document'
description = 'Dadok openApi3'
version = "${project.version}"
format = 'yaml'
}
task copyOpenApi3(type: Copy) {
dependsOn("openapi3")
println("run copyOpenApi3")
delete("src/main/resources/static/swagger-ui/openapi3.yaml") // κΈ°μ‘΄ OAS νμΌ μμ
from("$buildDir/api-spec/openapi3.yaml") // 볡μ ν OAS νμΌ μ§μ
into("src/main/resources/static/openapi3/") // νκ² λλ ν°λ¦¬λ‘ νμΌ λ³΅μ
}
// 1. logback-spring.xml νμΌμ΄ μλ κ²½λ‘λ₯Ό μ€μ
def logbackConfigDir = file('.')
// 2. JAR νμΌμ μμ±νκΈ° μ μ logback-spring.xml νμΌμ ν΄λΉ μμΉμ 볡μ¬.
task copyLogbackConfig(type: Copy) {
from logbackConfigDir
into 'build/resources/main'
include 'logback-spring.xml'
}
build {
dependsOn asciidoctor
dependsOn copyDocument
dependsOn copyLogbackConfig
dependsOn copyOpenApi3
}
bootJar {
dependsOn asciidoctor
dependsOn copyDocument
dependsOn copyLogbackConfig
dependsOn copyOpenApi3
println("run bootJar")
println("${asciidoctor.outputDir}")
copy {
from("${asciidoctor.outputDir}/html5") {
into "$buildDir/resources/main/static/docs"
}
}
copy {
from file("${buildDir}/docs/asciidoc")
into file("${buildDir}/resources/main/static/docs")
}
archiveName = version + ".dadok.jar"
// delete fileTree(dir: "${buildDir}/libs", include: "*plain.jar")
}