From dd74b9b0e36bbc69890aeecac98f918ce653c967 Mon Sep 17 00:00:00 2001 From: Alireza Ivaz Date: Wed, 21 Jun 2023 11:49:57 +0330 Subject: [PATCH] Migrate to Gradle Version Catalog --- app/build.gradle.kts | 25 ++++++++++++------------- build.gradle.kts | 4 ++-- gradle/libs.versions.toml | 30 ++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 2ea4ce7..9240b7e 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,6 +1,6 @@ plugins { - id("com.android.application") - id("kotlin-android") + alias(libs.plugins.application) + alias(libs.plugins.kotlin) } android { @@ -55,15 +55,14 @@ android { } dependencies { - implementation("androidx.appcompat:appcompat:1.6.1") - implementation("com.google.android.material:material:1.9.0") - implementation("androidx.preference:preference-ktx:1.2.0") - implementation("androidx.fragment:fragment-ktx:1.5.7") - implementation("androidx.core:core-ktx:1.10.1") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") - - val lifecycle_version = "2.6.1" - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version") - implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version") - implementation("androidx.lifecycle:lifecycle-common-java8:$lifecycle_version") + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.core.splashscreen) + implementation(libs.androidx.appcompat) + implementation(libs.androidx.fragment.ktx) + implementation(libs.androidx.lifecycle.common) + implementation(libs.androidx.lifecycle.livedata.ktx) + implementation(libs.androidx.lifecycle.viewmodel.ktx) + implementation(libs.androidx.preference.ktx) + implementation(libs.kotlinx.coroutines.core) + implementation(libs.material) } diff --git a/build.gradle.kts b/build.gradle.kts index 3131f3a..df60f77 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ plugins { - id("com.android.application") version "8.0.2" apply false - id("org.jetbrains.kotlin.android") version "1.8.0" apply false + alias(libs.plugins.application) apply false + alias(libs.plugins.kotlin) apply false } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..c211804 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,30 @@ +[versions] +android = "8.0.2" +fragment-ktx = "1.5.7" +kotlin = "1.8.0" +androidx-core = "1.10.1" +androidx-core-splashscreen = "1.0.1" +androidx-appcompat = "1.6.1" +androidx-fragment = "1.6.0" +androidx-lifecycle = "2.6.1" +androidx-preference = "1.2.0" +kotlinx-coroutines-core = "1.4.3" +material = "1.9.0" + +[libraries] +androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core" } +androidx-core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "androidx-core-splashscreen" } +androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" } +androidx-fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "androidx-fragment" } +androidx-lifecycle-common = { group = "androidx.lifecycle", name = "lifecycle-common-java8", version.ref = "androidx-lifecycle" } +androidx-lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "androidx-lifecycle" } +androidx-lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" } +androidx-preference-ktx = { group = "androidx.preference", name = "preference-ktx", version.ref = "androidx-preference" } +kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines-core" } +material = { group = "com.google.android.material", name = "material", version.ref = "material" } + +[plugins] +application = { id = "com.android.application", version.ref = "android" } +kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } + +[bundles]