-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
183 lines (155 loc) · 4.38 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
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.5'
id 'io.spring.dependency-management' version '1.1.4'
id 'jacoco'
id "org.sonarqube" version "4.4.1.3373"
//RestDocs
id "org.asciidoctor.jvm.convert" version "3.3.2"
}
sonar {
properties {
property "sonar.projectKey", "LoveMarker_LoveMarker-Server"
property "sonar.organization", "lovemarker"
property "sonar.host.url", "https://sonarcloud.io"
}
}
group = 'com'
version = '0.0.1-SNAPSHOT'
configurations {
//RestDocs
asciidoctorExt
}
java {
sourceCompatibility = '17'
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
// Health Check
implementation 'org.springframework.boot:spring-boot-starter-actuator'
// JPA & Database
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation group: 'org.postgresql', name: 'postgresql', version: '42.2.27'
runtimeOnly 'org.postgresql:postgresql'
runtimeOnly 'com.h2database:h2'
// cache
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
// hibernate-spatial
implementation 'org.hibernate:hibernate-spatial:6.1.7.Final'
//RestDocs
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
//JWT
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.2'
implementation group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.2'
implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.2'
// google login
implementation group: 'com.google.api-client', name: 'google-api-client', version: '1.30.0'
// S3 AWS
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-aws', version: '2.2.6.RELEASE'
}
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
//jacoco start
private excludedClassFilesForReport(classDirectories) {
classDirectories.setFrom(
files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"**/Q*",
"**/*Application*",
"**/*Config*",
"**/*Response*",
"**/*Request*",
"**/exception/**",
"**/Mock**",
"**/aspect/**",
"**/scheduler/**",
"**/global/**",
"**/common/**",
"**/*JwtService*",
"**/*TokenCacheService*",
"**/*SignInService*",
"**/*MemoryController*"
])
})
)
}
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