-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
223 lines (186 loc) ยท 6.11 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
buildscript {
ext {
queryDslVersion = "5.0.0"
}
}
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.1.3'
//RestDocs
id "org.asciidoctor.jvm.convert" version "3.3.2"
id 'jacoco'
id "org.sonarqube" version "4.4.1.3373"
}
sonar {
properties {
property "sonar.projectKey", "Anifriends_Anifriends-Backend"
property "sonar.organization", "anifriends"
property "sonar.host.url", "https://sonarcloud.io"
}
}
group = 'com.clova'
version = '0.0.1-SNAPSHOT'
configurations {
//RestDocs
asciidoctorExt
}
java {
sourceCompatibility = '17'
}
// plain jar ํ์ผ์ ์์ฑํ์ง ์๋๋ค.
jar {
enabled = false
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
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'
testImplementation 'org.projectlombok:lombok:1.18.22'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
// DB
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
//RestDocs
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
//querydsl
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
//jwt
implementation 'io.jsonwebtoken:jjwt-api:0.12.3'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.3'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.3'
//test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.awaitility:awaitility'
testImplementation "org.testcontainers:testcontainers:1.19.0"
testImplementation "org.testcontainers:junit-jupiter:1.19.0"
// S3 AWS
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-aws', version: '2.2.6.RELEASE'
testImplementation 'io.findify:s3mock_2.13:0.2.6'
// Websocket
implementation 'org.springframework.boot:spring-boot-starter-websocket'
// Monitoring
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-registry-prometheus'
// webflux
implementation 'org.springframework.boot:spring-boot-starter-webflux'
testImplementation("com.squareup.okhttp3:mockwebserver:4.9.1")
testImplementation 'org.awaitility:awaitility:4.2.0'
}
tasks.named('test') {
useJUnitPlatform()
finalizedBy jacocoTestReport // ํ
์คํธ ์คํ ํ ํญ์ report๊ฐ ์์ฑ๋ฉ๋๋ค.
}
//RestDocs start
ext {
snippetsDir = file('build/generated-snippets')
}
test {
outputs.dir snippetsDir
}
asciidoctor.doFirst {
delete file('src/main/resources/static/docs')
}
asciidoctor {
inputs.dir snippetsDir
configurations 'asciidoctorExt'
dependsOn test
}
bootJar {
dependsOn asciidoctor
from("${asciidoctor.outputDir}/html5") {
into 'static/docs'
}
}
tasks.register('copyDocument', Copy) {
dependsOn asciidoctor
from file("build/docs/asciidoc")
into file("src/main/resources/static/docs")
}
build {
dependsOn copyDocument
}
//RestDocs end
// Querydsl ์ค์ ๋ถ
def generated = 'src/main/generated'
// querydsl QClass ํ์ผ ์์ฑ ์์น๋ฅผ ์ง์
tasks.withType(JavaCompile) {
options.getGeneratedSourceOutputDirectory().set(file(generated))
}
// java source set ์ querydsl QClass ์์น ์ถ๊ฐ
sourceSets {
main.java.srcDirs += [generated]
}
// gradle clean ์์ QClass ๋๋ ํ ๋ฆฌ ์ญ์
clean {
delete file(generated)
}
//jacoco start
private excludedClassFilesForReport(classDirectories) {
classDirectories.setFrom(
files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**/Q*",
"**/*Application*",
"**/*Config*",
"**/*Response*",
"**/*Request*",
"**/exception/**",
"**/Mock**",
"**/aspect/**",
"**/scheduler/**"
])
})
)
}
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