Skip to content

Commit d053537

Browse files
committed
refactor: build 크기 수정
1 parent 3d34327 commit d053537

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ fun getProjectVersion(): String {
1313
.start()
1414

1515
if (process.waitFor() == 0) {
16-
// 정확한 태그가 있는 경우 (v1.0.0 → 1.0.0)
1716
process.inputStream.bufferedReader().readText().trim().removePrefix("v")
1817
} else {
1918
// 태그가 없는 경우 SNAPSHOT

cli/build.gradle.kts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ dependencies {
99
implementation(project(":core:api"))
1010
implementation(project(":core:impl"))
1111
implementation("com.github.ajalt.clikt:clikt:4.2.2")
12-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
12+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") {
13+
exclude(group = "org.jetbrains.kotlin") // Kotlin 의존성 중복 제거
14+
}
1315

1416
testImplementation(kotlin("test"))
1517
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
@@ -23,6 +25,37 @@ tasks {
2325
manifest {
2426
attributes["Main-Class"] = "com.commitchronicle.cli.MainKt"
2527
}
28+
29+
// JAR 최적화 설정
30+
minimize() // 사용하지 않는 클래스 제거
31+
mergeServiceFiles() // 서비스 파일 병합
32+
33+
// 중복 의존성 제거
34+
exclude("META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA")
35+
36+
// 프로퍼티 파일 통합
37+
relocate("META-INF/services", "services")
38+
relocate("META-INF/spring.*", "spring")
39+
40+
// 트랜지티브 의존성 최적화
41+
dependencies {
42+
exclude(dependency("org.jetbrains.kotlin:kotlin-stdlib"))
43+
exclude(dependency("org.jetbrains.kotlin:kotlin-stdlib-common"))
44+
}
45+
}
46+
47+
// 버전 정보 자동 업데이트 태스크
48+
register("updateVersion") {
49+
doLast {
50+
val versionFile = file("${project.buildDir}/version.txt")
51+
versionFile.parentFile.mkdirs()
52+
versionFile.writeText(project.version.toString())
53+
}
54+
}
55+
56+
// 빌드 시 버전 정보 자동 업데이트
57+
build {
58+
dependsOn("updateVersion")
2659
}
2760
}
2861

0 commit comments

Comments
 (0)