Миграция на Kotlin DSL
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
import org.gradle.api.artifacts.dsl.DependencyHandler
|
||||
|
||||
object AppDependencies {
|
||||
//std lib
|
||||
val kotlinStdLib = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}"
|
||||
|
||||
//android ui
|
||||
private val appcompat = "androidx.appcompat:appcompat:${Versions.appcompat}"
|
||||
private val coreKtx = "androidx.core:core-ktx:${Versions.coreKtx}"
|
||||
private val constraintLayout =
|
||||
"androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}"
|
||||
|
||||
private val pieChartLib = "com.github.PhilJay:MPAndroidChart:v3.1.0"
|
||||
|
||||
//test libs
|
||||
private val junit = "junit:junit:${Versions.junit}"
|
||||
private val extJUnit = "androidx.test.ext:junit:${Versions.extJunit}"
|
||||
private val espressoCore = "androidx.test.espresso:espresso-core:${Versions.espresso}"
|
||||
|
||||
val appLibraries = arrayListOf<String>().apply {
|
||||
add(kotlinStdLib)
|
||||
add(coreKtx)
|
||||
add(appcompat)
|
||||
add(constraintLayout)
|
||||
|
||||
add(pieChartLib)
|
||||
}
|
||||
|
||||
val androidTestLibraries = arrayListOf<String>().apply {
|
||||
add(extJUnit)
|
||||
add(espressoCore)
|
||||
}
|
||||
|
||||
val testLibraries = arrayListOf<String>().apply {
|
||||
add(junit)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//util functions for adding the different type dependencies from build.gradle file
|
||||
|
||||
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.testImplementation(list: List<String>){
|
||||
list.forEach { dependency ->
|
||||
add("testImplementation", dependency)
|
||||
}
|
||||
}
|
||||
|
||||
fun DependencyHandler.androidTestImplementation(list: List<String>){
|
||||
list.forEach { dependency ->
|
||||
add("androidTestImplementation", dependency)
|
||||
}
|
||||
}
|
||||
|
||||
fun DependencyHandler.coreLibraryDesugaring(list: List<String>){
|
||||
list.forEach { dependency ->
|
||||
add("coreLibraryDesugaring", dependency)
|
||||
}
|
||||
}
|
||||
|
||||
fun DependencyHandler.debugImplementation(list: List<String>){
|
||||
list.forEach { dependency ->
|
||||
add("debugImplementation", dependency)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user