From e28c55deb8a5902d17cb8b8fa4d933cde6ecca34 Mon Sep 17 00:00:00 2001 From: mahmood199 Date: Mon, 26 Feb 2024 23:08:08 +0530 Subject: [PATCH] Refactoring to version catalog for plugins and libraries --- .idea/deploymentTargetDropDown.xml | 3 -- .idea/deploymentTargetSelector.xml | 10 ------- .idea/vcs.xml | 2 +- app/build.gradle.kts | 17 ++++++------ baselineProfile/build.gradle.kts | 14 +++++----- benchmark/build.gradle.kts | 12 ++++---- build.gradle.kts | 20 +++++++------- data/build.gradle.kts | 18 ++++++------ gradle/libs.versions.toml | 35 ++++++++++++++++++++++-- gradle/wrapper/gradle-wrapper.properties | 2 +- 10 files changed, 74 insertions(+), 59 deletions(-) delete mode 100644 .idea/deploymentTargetSelector.xml diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index 946ab354..0c0c3383 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -2,9 +2,6 @@ - - - diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml deleted file mode 100644 index b268ef36..00000000 --- a/.idea/deploymentTargetSelector.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7f..35eb1ddf 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 06cca888..163637de 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,15 +1,14 @@ plugins { - id("com.android.application") - id("org.jetbrains.kotlin.android") - id("com.google.dagger.hilt.android") + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.dagger.hilt.android) id("kotlin-parcelize") - id("kotlin-android") id("kotlinx-serialization") - id("com.google.devtools.ksp") - id("androidx.baselineprofile") - id("com.google.gms.google-services") - id("com.google.firebase.crashlytics") - id("com.google.firebase.firebase-perf") + alias(libs.plugins.ksp) + alias(libs.plugins.androidx.baselineprofile) + alias(libs.plugins.google.services) + alias(libs.plugins.firebase.crashlytics) + alias(libs.plugins.firebase.perf) alias(libs.plugins.paparazzi) } diff --git a/baselineProfile/build.gradle.kts b/baselineProfile/build.gradle.kts index 8cf09cd4..488e6b85 100644 --- a/baselineProfile/build.gradle.kts +++ b/baselineProfile/build.gradle.kts @@ -1,9 +1,9 @@ import com.android.build.api.dsl.ManagedVirtualDevice plugins { - id("com.android.test") - id("org.jetbrains.kotlin.android") - id("androidx.baselineprofile") + alias(libs.plugins.android.test) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.androidx.baselineprofile) } android { @@ -45,8 +45,8 @@ baselineProfile { } dependencies { - implementation("androidx.test.ext:junit:1.1.5") - implementation("androidx.test.espresso:espresso-core:3.5.1") - implementation("androidx.test.uiautomator:uiautomator:2.2.0") - implementation("androidx.benchmark:benchmark-macro-junit4:1.2.2") + implementation(libs.androidx.test.ext.junit) + implementation(libs.androidx.test.espresso.core) + implementation(libs.androidx.uiautomator) + implementation(libs.androidx.benchmark.macro.junit4) } \ No newline at end of file diff --git a/benchmark/build.gradle.kts b/benchmark/build.gradle.kts index 8a87e070..b47286d4 100644 --- a/benchmark/build.gradle.kts +++ b/benchmark/build.gradle.kts @@ -1,6 +1,6 @@ plugins { - id("com.android.test") - id("org.jetbrains.kotlin.android") + alias(libs.plugins.android.test) + alias(libs.plugins.kotlin.android) } android { @@ -39,10 +39,10 @@ android { } dependencies { - implementation("androidx.test.ext:junit:1.1.5") - implementation("androidx.test.espresso:espresso-core:3.5.1") - implementation("androidx.test.uiautomator:uiautomator:2.2.0") - implementation("androidx.benchmark:benchmark-macro-junit4:1.2.2") + implementation(libs.androidx.test.ext.junit) + implementation(libs.androidx.test.espresso.core) + implementation(libs.androidx.uiautomator) + implementation(libs.androidx.benchmark.macro.junit4) } androidComponents { diff --git a/build.gradle.kts b/build.gradle.kts index 87b5725c..2fb94323 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,15 +1,15 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id("com.android.application") version "8.4.0-alpha08" apply false - id("com.android.library") version "8.4.0-alpha08" apply false - id("org.jetbrains.kotlin.android") version "1.9.10" apply false - id("com.google.dagger.hilt.android") version "2.50" apply false - id("com.android.test") version "8.4.0-alpha08" apply false - id("androidx.baselineprofile") version "1.2.3" apply false - id("com.google.gms.google-services") version "4.4.0" apply false - id("com.google.firebase.crashlytics") version "2.9.9" apply false - id("com.google.firebase.firebase-perf") version "1.4.2" apply false - id("com.google.devtools.ksp") version "1.9.10-1.0.13" apply false + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.dagger.hilt.android) apply false + alias(libs.plugins.android.test) apply false + alias(libs.plugins.androidx.baselineprofile) apply false + alias(libs.plugins.google.services) apply false + alias(libs.plugins.firebase.crashlytics) apply false + alias(libs.plugins.firebase.perf) apply false + alias(libs.plugins.ksp) apply false alias(libs.plugins.paparazzi) apply false } diff --git a/data/build.gradle.kts b/data/build.gradle.kts index 448d4db1..1809371f 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -1,9 +1,9 @@ plugins { - id("com.android.library") - id("org.jetbrains.kotlin.android") + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) id("kotlin-kapt") id("kotlin-parcelize") - id("com.google.dagger.hilt.android") + alias(libs.plugins.dagger.hilt.android) } android { @@ -61,12 +61,12 @@ android { dependencies { - implementation("androidx.core:core-ktx:1.12.0") - implementation("androidx.appcompat:appcompat:1.6.1") - implementation("com.google.android.material:material:1.11.0") - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.ext:junit:1.1.5") - androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + implementation(libs.androidx.ktx) + implementation(libs.androidx.appcompat) + implementation(libs.android.material) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.test.ext.junit) + androidTestImplementation(libs.androidx.test.espresso.core) implementation(libs.hilt.android) kapt(libs.hilt.compiler) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d0fa5636..4564eb40 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,10 +1,11 @@ [versions] +benchmarkMacroJunit4 = "1.2.2" coreTesting = "2.2.0" hiltAndroidCompiler = "2.50" hiltAndroidGradlePlugin = "2.50" hiltAndroidTesting = "2.50" kotlinGradlePlugin = "1.6.21" -kotlinSerialization = "1.9.10" +kotlin-version = "1.9.10" kotlinxCoroutinesTest = "1.6.1" kotlinxCoroutinesTestJvm = "1.7.3" ktx = "1.12.0" @@ -54,13 +55,29 @@ shortcut-core = "1.0.0" firebase-bom = "32.7.1" turbine = "0.13.0" + +# Plugins verison +android-application = "8.2.2" +android-library = "8.2.2" +kotlin-android = "1.9.10" +dagger-hilt-android = "2.50" +android-test = "8.2.2" +androidx-baselineprofile = "1.2.3" +google-services = "4.4.0" +firebase-crashlytics = "2.9.9" +firebase-perf = "1.4.2" +ksp = "1.9.10-1.0.13" +uiautomator = "2.3.0" + [libraries] +androidx-benchmark-macro-junit4 = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "benchmarkMacroJunit4" } androidx-core-testing = { module = "androidx.arch.core:core-testing", version.ref = "coreTesting" } androidx-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "ktx" } androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } android-material = { group = "com.google.android.material", name = "material", version.ref = "material" } androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version.ref = "profileinstaller" } +androidx-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiautomator" } constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraint-layout" } activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activity-compose" } compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" } @@ -79,7 +96,7 @@ hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", vers kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinGradlePlugin" } -kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlinSerialization" } +kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin-version" } kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinxCoroutinesTest" } kotlinx-coroutines-test-jvm = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test-jvm", version.ref = "kotlinxCoroutinesTestJvm" } lottie-compose = { module = "com.airbnb.android:lottie-compose", version.ref = "lottieCompose" } @@ -182,4 +199,16 @@ turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" } [plugins] -paparazzi = { id = "app.cash.paparazzi", version.ref = "paparazziGradlePlugin" } \ No newline at end of file +paparazzi = { id = "app.cash.paparazzi", version.ref = "paparazziGradlePlugin" } +android-application = { id = "com.android.application", version.ref = "android-application" } +android-library = { id = "com.android.library", version.ref = "android-library" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin-android" } +dagger-hilt-android = { id = "com.google.dagger.hilt.android", version.ref = "dagger-hilt-android" } +android-test = { id = "com.android.test", version.ref = "android-test" } +androidx-baselineprofile = { id = "androidx.baselineprofile", version.ref = "androidx-baselineprofile" } +google-services = { id = "com.google.gms.google-services", version.ref = "google-services" } +firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebase-crashlytics" } +firebase-perf = { id = "com.google.firebase.firebase-perf", version.ref = "firebase-perf" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +kotlin-parcelize = { id = "kotlin-parcelize", version.ref = "kotlin-version" } +kotlinx-serialization = { id = "kotlinx-serialization" , version.ref = "kotlin-version" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c7a7ce86..011c473d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed Sep 13 10:30:41 IST 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-rc-1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists