-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
127 lines (106 loc) · 3.9 KB
/
build.gradle.kts
File metadata and controls
127 lines (106 loc) · 3.9 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
plugins {
kotlin("jvm")
kotlin("kapt")
kotlin("plugin.spring") apply false
kotlin("plugin.jpa") apply false
id("org.springframework.boot") apply false
id("io.spring.dependency-management") apply false
id("com.diffplug.spotless")
}
group = "com.sandbox"
description = "sandbox-backend"
java {
sourceCompatibility = JavaVersion.VERSION_21
}
kotlin {
compilerOptions {
jvmToolchain(21)
freeCompilerArgs.addAll("-Xjsr305=strict")
}
}
subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jetbrains.kotlin.kapt")
apply(plugin = "org.jetbrains.kotlin.plugin.spring")
apply(plugin = "org.springframework.boot")
apply(plugin = "io.spring.dependency-management")
apply(plugin = "com.diffplug.spotless")
val p6spyVersion: String by project.extra
dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("com.github.gavlyukovskiy:p6spy-spring-boot-starter:$p6spyVersion")
implementation("io.github.microutils:kotlin-logging-jvm:3.0.5")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.register<Copy>("installGitHooks") {
from(File(rootProject.rootDir, "gradle/githooks/pre-commit"))
into(File(rootProject.rootDir, ".git/hooks"))
filesMatching("pre-commit") {
filePermissions { unix("rwxr-xr-x") }
}
}
tasks.named("build").configure {
dependsOn("installGitHooks")
}
spotless {
// 변경된 파일만 검사하도록 설정하여 속도 향상
// ratchetFrom("HEAD")
kotlin {
ktlint("1.4.1")
.editorConfigOverride(
mapOf(
"charset" to "utf-8",
"end_of_line" to "lf",
"insert_final_newline" to true,
"indent_style" to "space",
"indent_size" to 4,
"max_line_length" to 120,
"trim_trailing_whitespace" to true,
"ij_kotlin_allow_trailing_comma" to true,
"ij_kotlin_allow_trailing_comma_on_call_site" to true,
"no-wildcard-imports" to true,
),
)
target("**/*.kt")
targetExclude(
"build/**/*.kt",
"bin/**/*.kt",
"**/package-info.kt",
"**/src/testFixtures/**/*.kt",
)
trimTrailingWhitespace()
endWithNewline()
}
kotlinGradle {
ktlint("1.4.1")
target("*.gradle.kts") // default target for kotlinGradle
}
java {
// 캐시 활성화로 증분 포맷팅 지원
toggleOffOn()
// Palantir Java Format 사용
// https://github.com/palantir/palantir-java-format
palantirJavaFormat("2.61.0")
// 특정 파일 제외
targetExclude("build/**", ".gradle/**")
// 불필요한 import 정리
removeUnusedImports()
// 정렬 규칙 (.editorconfig와 일치)
importOrder("java", "javax", "jakarta", "org", "com", "")
// .editorconfig와 동일한 import 설정 적용
// 실제로는 palantir 포맷터에 이 설정이 직접 적용되지 않을 수 있음
// 필요한 경우 IntelliJ 설정에서 추가로 구성해야 함
}
format("misc") {
target("*.gradle", "*.md", ".gitignore")
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
}
}