-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
221 lines (186 loc) · 6.94 KB
/
build.gradle
File metadata and controls
221 lines (186 loc) · 6.94 KB
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
import java.nio.file.Files
import java.nio.charset.StandardCharsets
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.1'
id 'io.spring.dependency-management' version '1.1.7'
id 'com.github.node-gradle.node' version '7.1.0'
id 'org.asciidoctor.jvm.convert' version '4.0.4'
}
group = 'kr.co'
version = '1.2.0'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
asciidoctorExt
}
repositories {
mavenCentral()
}
ext {
snippetsDir = file('build/generated-snippets')
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-aop'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0'
implementation "org.springframework.boot:spring-boot-starter-mail"
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'
runtimeOnly 'org.postgresql:postgresql'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
implementation platform('software.amazon.awssdk:bom:2.20.15')
implementation 'software.amazon.awssdk:core:2.20.15'
implementation 'software.amazon.awssdk:s3:2.20.15'
testImplementation "cloud.localstack:localstack-utils:0.2.20"
testImplementation "org.testcontainers:localstack"
testImplementation 'org.testcontainers:junit-jupiter'
// secretsmanager
implementation 'software.amazon.awssdk:secretsmanager:2.20.15'
implementation 'software.amazon.awssdk:auth:2.20.15'
implementation 'software.amazon.awssdk:regions:2.20.15'
// oauth 의존성
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
// 설정값 더 구조적으로 관리하기 위한 의존성
implementation 'org.springframework.boot:spring-boot-configuration-processor'
// webclinet
implementation 'org.springframework.boot:spring-boot-starter-webflux'
// entitymanager 연결
implementation 'org.javassist:javassist:3.15.0-GA'
// google people
implementation 'com.google.apis:google-api-services-people:v1-rev20210419-1.31.0'
// wireMock
testImplementation 'org.wiremock:wiremock-standalone:3.9.1'
// logback cloudwatch
implementation 'ca.pjer:logback-awslogs-appender:1.6.0'
// logback json formatter output
// implementation 'net.logstash.logback:logstash-logback-encoder:7.4'
// jwt 의존성
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5' // JSON 직렬화를 위해 필요
testImplementation 'com.h2database:h2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'org.springframework.security:spring-security-test'
// rest-assured(java dsl)
testImplementation 'io.rest-assured:rest-assured'
testImplementation 'io.rest-assured:json-path'
// REST Docs 관련 의존성 추가 (테스트 코드에서 REST Docs 사용 가능)
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc:3.0.3'
testImplementation 'org.springframework.restdocs:spring-restdocs-core:3.0.3'
asciidoctorExt 'org.springframework.restdocs:spring-restdocs-asciidoctor:3.0.3'
// WebClient Test
testImplementation 'com.squareup.okhttp3:mockwebserver:4.12.0'
implementation 'org.springframework.retry:spring-retry'
// Cache
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'com.github.ben-manes.caffeine:caffeine'
}
tasks.named('test') {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
outputs.dir snippetsDir
// TODO: fail로 인해 잠시 제외
exclude '**/MemberApiControllerIntegrationTest.class'
exclude '**/MockSecurityContextTest.class'
exclude '**/GoogleOAuthTest.class'
exclude '**/NaverOAuthTest.class'
exclude '**/SecurityUtilTest.class'
}
node {
version = '22.14.0'
npmVersion = '11.2.0'
download = true
}
// todo : 추후에 전역 함수들 수정하면 적용
//def terserCacheFile = layout.buildDirectory.file("terser-cache.json")
//tasks.register("initializeTerserCache") {
// doFirst {
// def cacheFile = terserCacheFile.get().asFile
// if (!cacheFile.exists()) {
// cacheFile.parentFile.mkdirs()
// cacheFile.text = '{}' // 빈 JSON 파일 생성
// }
// }
//}
// 동적 Minify 태스크 생성
def minifyTasks = []
fileTree('src/main/resources/static/js').each { file ->
if (file.name.endsWith('.js') && !file.name.endsWith('.min.js')) {
def taskName = "minifyJs_${file.name.replace('.js', '')}"
tasks.register(taskName, NpmTask) {
// 출력 경로를 File 객체로 직접 생성
def outputFile = layout.buildDirectory.file("resources/main/static/js/${file.name.replace('.js', '.min.js')}").get().asFile
args = [
'run', 'minify', '--',
file.absolutePath,
'--output', outputFile.absolutePath,
'--compress', 'passes=3',
'--mangle', 'toplevel=false',
// '--name-cache', terserCacheFile.get().asFile.absolutePath
// '--mangle-props', 'reserved=["classList","querySelector","getAttribute","setAttribute","textContent"]'
]
dependsOn npmInstall
doFirst {
outputFile.parentFile.mkdirs()
}
}
minifyTasks << tasks[taskName]
}
}
def replaceImportPaths = tasks.register("replaceImportPaths") {
onlyIf { project.hasProperty('prod') }
dependsOn minifyTasks
doLast {
def jsDir = layout.buildDirectory.dir("resources/main/static/js").get().asFile
fileTree(jsDir).include("**/*.min.js").each { file ->
def content = file.text
// from 뒤에 오는 "경로.js" 부분을 찾아 "경로.min.js"로 변경
def newContent = content.replaceAll(/(from\s*["'])([^"']*?)(\.js)(["'])/, '$1$2.min.js$4')
// 변경이 일어난 경우에만 파일을 다시 씀
if (content != newContent) {
println "Replacing import paths in: ${file.name}" // 변경 로그 출력
Files.write(file.toPath(), newContent.getBytes(StandardCharsets.UTF_8))
}
}
}
}
processResources {
if (project.hasProperty('prod')) {
exclude 'static/js/*.js'
}
}
tasks.named('asciidoctor') {
inputs.dir snippetsDir // REST Docs 스니펫 입력 경로 지정
configurations 'asciidoctorExt' // asciidoctor 확장 설정
sources {
include("**/index.adoc")
}
baseDirFollowsSourceFile()
dependsOn test // 테스트 태스크 완료 후 문서 생성
}
bootJar {
enabled = true
dependsOn replaceImportPaths
dependsOn asciidoctor // 문서 생성 후 jar 생성
from("${asciidoctor.outputDir}") {
into 'static/docs' // 문서 접근 경로 (http://localhost:8080/docs/)
}
}
jar {
enabled = false
}