Skip to content

Commit

Permalink
feat: dependencies list
Browse files Browse the repository at this point in the history
- 비슷한 라이브러리들 하나의 List로 만들기
  • Loading branch information
lee-ji-hoon committed Nov 8, 2022
1 parent 1d00e8e commit 49d79e8
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 27 deletions.
2 changes: 0 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,4 @@ dependencies {
implementation(project(":domain"))
implementation(project(":presentation"))
implementation(project(":data"))

implementation(Libraries.CORE)
}
63 changes: 54 additions & 9 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.gradle.api.artifacts.dsl.DependencyHandler

object Versions {
const val APP_COMPAT = "1.5.1"
const val CORE = "1.7.0"
Expand All @@ -11,19 +13,62 @@ object Versions {

object Libraries {
// androidX + KTX
const val CORE = "androidx.core:core-ktx:${Versions.CORE}"
const val APP_COMPAT = "androidx.appcompat:appcompat:${Versions.APP_COMPAT}"
const val CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout:${Versions.CONSTRAINT_LAYOUT}"
const val NAVIGATION_FRAGMENT_KTX = "androidx.navigation:navigation-fragment-ktx:${Versions.NAVIGATION_FRAGMENT}"
const val NAVIGATION_UI_KTX = "androidx.navigation:navigation-ui-ktx:${Versions.NAVIGATION_FRAGMENT}"
const val MATERIAL = "com.google.android.material:material:${Versions.MATERIAL}"
private const val CORE = "androidx.core:core-ktx:${Versions.CORE}"
private const val APP_COMPAT = "androidx.appcompat:appcompat:${Versions.APP_COMPAT}"
private const val CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout:${Versions.CONSTRAINT_LAYOUT}"
private const val NAVIGATION_FRAGMENT_KTX =
"androidx.navigation:navigation-fragment-ktx:${Versions.NAVIGATION_FRAGMENT}"
private const val NAVIGATION_UI_KTX = "androidx.navigation:navigation-ui-ktx:${Versions.NAVIGATION_FRAGMENT}"
private const val MATERIAL = "com.google.android.material:material:${Versions.MATERIAL}"

val VIEW_LIBRARIES = arrayListOf<String>().apply {
add(CORE)
add(APP_COMPAT)
add(CONSTRAINT_LAYOUT)
add(NAVIGATION_FRAGMENT_KTX)
add(NAVIGATION_UI_KTX)
add(MATERIAL)
}
}

object TestImpl {
const val JUNIT4 = "junit:junit:${Versions.JUNIT}" // TODO 5 쓰는 쪽으로 바꿔야함
private const val JUNIT4 = "junit:junit:${Versions.JUNIT}" // TODO 5 쓰는 쪽으로 바꿔야함

val TEST_LIBRARIES = arrayListOf<String>().apply {
add(JUNIT4)
}
}

object AndroidTestImpl {
const val ANDROID_JUNIT = "androidx.test.ext:junit:${Versions.ANDROID_JUNIT}"
const val ESPRESSO = "androidx.test.espresso:espresso-core:${Versions.ESPRESSO}"
private const val ANDROID_JUNIT = "androidx.test.ext:junit:${Versions.ANDROID_JUNIT}"
private const val ESPRESSO = "androidx.test.espresso:espresso-core:${Versions.ESPRESSO}"

val ANDROID_LIBRARIES = arrayListOf<String>().apply {
add(ANDROID_JUNIT)
add(ESPRESSO)
}
}

fun DependencyHandler.kapt(list: List<String>) {
list.forEach { dependency ->
add("kapt", dependency)
}
}

fun DependencyHandler.implementation(list: List<String>) {
list.forEach { dependency ->
add("implementation", dependency)
}
}

fun DependencyHandler.androidTestImplementation(list: List<String>) {
list.forEach { dependency ->
add("androidTestImplementation", dependency)
}
}

fun DependencyHandler.testImplementation(list: List<String>) {
list.forEach { dependency ->
add("testImplementation", dependency)
}
}
9 changes: 2 additions & 7 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ android {
dependencies {
implementation(project(":domain"))

implementation(Libraries.CORE)
implementation(Libraries.APP_COMPAT)
implementation(Libraries.MATERIAL)

testImplementation(TestImpl.JUNIT4)
androidTestImplementation(AndroidTestImpl.ANDROID_JUNIT)
androidTestImplementation(AndroidTestImpl.ESPRESSO)
implementation(TestImpl.TEST_LIBRARIES)
androidTestImplementation(AndroidTestImpl.ANDROID_LIBRARIES)
}
12 changes: 3 additions & 9 deletions presentation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ android {
dependencies {
implementation(project(":domain"))

implementation(Libraries.CORE)
implementation(Libraries.APP_COMPAT)
implementation(Libraries.MATERIAL)
implementation(Libraries.CONSTRAINT_LAYOUT)
implementation(Libraries.NAVIGATION_FRAGMENT_KTX)
implementation(Libraries.NAVIGATION_UI_KTX)
testImplementation(TestImpl.JUNIT4)
androidTestImplementation(AndroidTestImpl.ANDROID_JUNIT)
androidTestImplementation(AndroidTestImpl.ESPRESSO)
implementation(Libraries.VIEW_LIBRARIES)
implementation(TestImpl.TEST_LIBRARIES)
androidTestImplementation(AndroidTestImpl.ANDROID_LIBRARIES)
}

0 comments on commit 49d79e8

Please sign in to comment.