Skip to content

Commit 49d79e8

Browse files
committed
feat: dependencies list
- 비슷한 라이브러리들 하나의 List로 만들기
1 parent 1d00e8e commit 49d79e8

File tree

4 files changed

+59
-27
lines changed

4 files changed

+59
-27
lines changed

app/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,4 @@ dependencies {
3939
implementation(project(":domain"))
4040
implementation(project(":presentation"))
4141
implementation(project(":data"))
42-
43-
implementation(Libraries.CORE)
4442
}
Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.gradle.api.artifacts.dsl.DependencyHandler
2+
13
object Versions {
24
const val APP_COMPAT = "1.5.1"
35
const val CORE = "1.7.0"
@@ -11,19 +13,62 @@ object Versions {
1113

1214
object Libraries {
1315
// androidX + KTX
14-
const val CORE = "androidx.core:core-ktx:${Versions.CORE}"
15-
const val APP_COMPAT = "androidx.appcompat:appcompat:${Versions.APP_COMPAT}"
16-
const val CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout:${Versions.CONSTRAINT_LAYOUT}"
17-
const val NAVIGATION_FRAGMENT_KTX = "androidx.navigation:navigation-fragment-ktx:${Versions.NAVIGATION_FRAGMENT}"
18-
const val NAVIGATION_UI_KTX = "androidx.navigation:navigation-ui-ktx:${Versions.NAVIGATION_FRAGMENT}"
19-
const val MATERIAL = "com.google.android.material:material:${Versions.MATERIAL}"
16+
private const val CORE = "androidx.core:core-ktx:${Versions.CORE}"
17+
private const val APP_COMPAT = "androidx.appcompat:appcompat:${Versions.APP_COMPAT}"
18+
private const val CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout:${Versions.CONSTRAINT_LAYOUT}"
19+
private const val NAVIGATION_FRAGMENT_KTX =
20+
"androidx.navigation:navigation-fragment-ktx:${Versions.NAVIGATION_FRAGMENT}"
21+
private const val NAVIGATION_UI_KTX = "androidx.navigation:navigation-ui-ktx:${Versions.NAVIGATION_FRAGMENT}"
22+
private const val MATERIAL = "com.google.android.material:material:${Versions.MATERIAL}"
23+
24+
val VIEW_LIBRARIES = arrayListOf<String>().apply {
25+
add(CORE)
26+
add(APP_COMPAT)
27+
add(CONSTRAINT_LAYOUT)
28+
add(NAVIGATION_FRAGMENT_KTX)
29+
add(NAVIGATION_UI_KTX)
30+
add(MATERIAL)
31+
}
2032
}
2133

2234
object TestImpl {
23-
const val JUNIT4 = "junit:junit:${Versions.JUNIT}" // TODO 5 쓰는 쪽으로 바꿔야함
35+
private const val JUNIT4 = "junit:junit:${Versions.JUNIT}" // TODO 5 쓰는 쪽으로 바꿔야함
36+
37+
val TEST_LIBRARIES = arrayListOf<String>().apply {
38+
add(JUNIT4)
39+
}
2440
}
2541

2642
object AndroidTestImpl {
27-
const val ANDROID_JUNIT = "androidx.test.ext:junit:${Versions.ANDROID_JUNIT}"
28-
const val ESPRESSO = "androidx.test.espresso:espresso-core:${Versions.ESPRESSO}"
43+
private const val ANDROID_JUNIT = "androidx.test.ext:junit:${Versions.ANDROID_JUNIT}"
44+
private const val ESPRESSO = "androidx.test.espresso:espresso-core:${Versions.ESPRESSO}"
45+
46+
val ANDROID_LIBRARIES = arrayListOf<String>().apply {
47+
add(ANDROID_JUNIT)
48+
add(ESPRESSO)
49+
}
50+
}
51+
52+
fun DependencyHandler.kapt(list: List<String>) {
53+
list.forEach { dependency ->
54+
add("kapt", dependency)
55+
}
56+
}
57+
58+
fun DependencyHandler.implementation(list: List<String>) {
59+
list.forEach { dependency ->
60+
add("implementation", dependency)
61+
}
62+
}
63+
64+
fun DependencyHandler.androidTestImplementation(list: List<String>) {
65+
list.forEach { dependency ->
66+
add("androidTestImplementation", dependency)
67+
}
68+
}
69+
70+
fun DependencyHandler.testImplementation(list: List<String>) {
71+
list.forEach { dependency ->
72+
add("testImplementation", dependency)
73+
}
2974
}

data/build.gradle.kts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ android {
3434
dependencies {
3535
implementation(project(":domain"))
3636

37-
implementation(Libraries.CORE)
38-
implementation(Libraries.APP_COMPAT)
39-
implementation(Libraries.MATERIAL)
40-
41-
testImplementation(TestImpl.JUNIT4)
42-
androidTestImplementation(AndroidTestImpl.ANDROID_JUNIT)
43-
androidTestImplementation(AndroidTestImpl.ESPRESSO)
37+
implementation(TestImpl.TEST_LIBRARIES)
38+
androidTestImplementation(AndroidTestImpl.ANDROID_LIBRARIES)
4439
}

presentation/build.gradle.kts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,7 @@ android {
3838
dependencies {
3939
implementation(project(":domain"))
4040

41-
implementation(Libraries.CORE)
42-
implementation(Libraries.APP_COMPAT)
43-
implementation(Libraries.MATERIAL)
44-
implementation(Libraries.CONSTRAINT_LAYOUT)
45-
implementation(Libraries.NAVIGATION_FRAGMENT_KTX)
46-
implementation(Libraries.NAVIGATION_UI_KTX)
47-
testImplementation(TestImpl.JUNIT4)
48-
androidTestImplementation(AndroidTestImpl.ANDROID_JUNIT)
49-
androidTestImplementation(AndroidTestImpl.ESPRESSO)
41+
implementation(Libraries.VIEW_LIBRARIES)
42+
implementation(TestImpl.TEST_LIBRARIES)
43+
androidTestImplementation(AndroidTestImpl.ANDROID_LIBRARIES)
5044
}

0 commit comments

Comments
 (0)