Миграция на Kotlin DSL
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import org.gradle.kotlin.dsl.`kotlin-dsl`
|
||||
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
//Константы уровня приложения
|
||||
object AppConfig {
|
||||
|
||||
const val compileSdk = 33
|
||||
const val minSdk = 21
|
||||
const val targetSdk = 32
|
||||
const val versionCode = 1
|
||||
const val versionName = "1.0.0"
|
||||
const val buildToolsVersion = "29.0.3"
|
||||
|
||||
const val androidTestInstrumentation = "androidx.test.runner.AndroidJUnitRunner"
|
||||
const val proguardConsumerRules = "consumer-rules.pro"
|
||||
const val dimension = "environment"
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
//константы версии
|
||||
//для зависимостей Kotlin DSL
|
||||
object Versions {
|
||||
|
||||
//app level
|
||||
const val gradle = "7.2.1"
|
||||
const val kotlin = "1.8.10"
|
||||
|
||||
//libs
|
||||
val coreKtx = "1.7.0"
|
||||
val appcompat = "1.3.0-alpha01"
|
||||
val constraintLayout = "2.0.0-beta8"
|
||||
|
||||
val compose = "1.4.4"
|
||||
|
||||
//test
|
||||
val junit = "4.12"
|
||||
val extJunit = "1.1.1"
|
||||
val espresso = "3.2.0"
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user