From 6299ff5b486a2f4031455f799ab123d3a9b2938d Mon Sep 17 00:00:00 2001 From: Rom Reviewer <5242439+romreviewer@users.noreply.github.com> Date: Fri, 14 Jul 2023 16:03:42 +0530 Subject: [PATCH] chore: migrate dependencies to version catalogs (#58) --- app/build.gradle.kts | 92 ++++++++++++++++------------------- build.gradle.kts | 7 +-- gradle/libs.versions.toml | 100 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 145 insertions(+), 54 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index bb0f1463..836a8d23 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,10 +1,9 @@ plugins { - id("com.android.application") - id("org.jetbrains.kotlin.android") - id("com.google.devtools.ksp") + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.devtools) id("kotlin-parcelize") kotlin("plugin.serialization") version "1.8.21" - id("com.mikepenz.aboutlibraries.plugin") version "10.8.0" } android { @@ -62,79 +61,70 @@ kotlin { dependencies { // AndroidX Core - implementation("androidx.core:core-ktx:1.10.1") - implementation("androidx.lifecycle:lifecycle-runtime-compose:2.6.1") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1") - implementation("androidx.core:core-splashscreen:1.0.1") - implementation("androidx.activity:activity-compose:1.7.2") - implementation("androidx.paging:paging-common-ktx:3.1.1") - implementation("androidx.work:work-runtime-ktx:2.8.1") + implementation(libs.androidx.ktx) + implementation(libs.runtime.ktx) + implementation(libs.runtime.compose) + implementation(libs.splash.screen) + implementation(libs.compose.activity) + implementation(libs.paging.common.ktx) + implementation(libs.work.runtime.ktx) // Compose - implementation(platform("androidx.compose:compose-bom:2023.06.01")) - implementation("androidx.compose.ui:ui") - implementation("androidx.compose.ui:ui-tooling-preview") - implementation("androidx.compose.runtime:runtime-livedata") - implementation("androidx.compose.material:material-icons-extended") - implementation("androidx.compose.material3:material3") + implementation(platform(libs.compose.bom)) + implementation(libs.compose.ui) + implementation(libs.compose.ui.preview) + implementation(libs.compose.livedata) + implementation(libs.compose.material.icons.extended) + implementation(libs.compose.material3) // Accompanist - val accompanistVersion = "0.30.1" - //implementation("com.google.accompanist:accompanist-systemuicontroller:$accompanistVersion") - //implementation("com.google.accompanist:accompanist-placeholder-material:$accompanistVersion") - implementation("com.google.accompanist:accompanist-drawablepainter:$accompanistVersion") - implementation("com.google.accompanist:accompanist-webview:$accompanistVersion") - //implementation("com.google.accompanist:accompanist-flowlayout:$accompanistVersion") - //implementation("com.google.accompanist:accompanist-permissions:$accompanistVersion") + implementation(libs.accompanist.drawablepainter) + implementation(libs.accompanist.webview) // HTML Scraper - implementation("it.skrape:skrapeit:1.1.5") { + implementation(libs.skrapeit) { exclude(group = "xml-apis", module = "xml-apis") } // Coil (async image loading, network image) - implementation("io.coil-kt:coil-compose:2.4.0") - implementation("me.zhanghai.android.appiconloader:appiconloader-coil:1.5.0") + implementation(libs.coil.compose) + implementation(libs.coil.appiconloader) // KotlinX - val serializationVersion = "1.5.1" - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion") - implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.5") + implementation(libs.kotlinx.serialization.json) + implementation(libs.kotlinx.collection.immutable) // Room - val roomVersion = "2.5.2" - implementation("androidx.room:room-runtime:$roomVersion") - implementation("androidx.room:room-ktx:$roomVersion") - annotationProcessor("androidx.room:room-compiler:$roomVersion") - ksp("androidx.room:room-compiler:$roomVersion") + implementation(libs.room.runtime) + implementation(libs.room.ktx) + annotationProcessor(libs.room.compiler) + ksp(libs.room.compiler) // ReVanced - implementation("app.revanced:revanced-patcher:11.0.4") + implementation(libs.patcher) // Signing - implementation("com.android.tools.build:apksig:8.0.2") - implementation("org.bouncycastle:bcpkix-jdk15on:1.70") + implementation(libs.apksign) + implementation(libs.bcpkix.jdk15on) // Koin - val koinVersion = "3.4.2" - implementation("io.insert-koin:koin-android:$koinVersion") - implementation("io.insert-koin:koin-androidx-compose:3.4.5") - implementation("io.insert-koin:koin-androidx-workmanager:$koinVersion") + implementation(libs.koin.android) + implementation(libs.koin.compose) + implementation(libs.koin.workmanager) // Compose Navigation - implementation("dev.olshevski.navigation:reimagined:1.4.0") + implementation(libs.reimagined.navigation) // Licenses - implementation("com.mikepenz:aboutlibraries-compose:10.8.0") + implementation(libs.about.libraries) // Ktor - val ktorVersion = "2.3.2" - implementation("io.ktor:ktor-client-core:$ktorVersion") - implementation("io.ktor:ktor-client-logging:$ktorVersion") - implementation("io.ktor:ktor-client-okhttp:$ktorVersion") - implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion") - implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion") + implementation(libs.ktor.core) + implementation(libs.ktor.logging) + implementation(libs.ktor.okhttp) + implementation(libs.ktor.content.negotiation) + implementation(libs.ktor.serialization) // Markdown to HTML - implementation("org.jetbrains:markdown:0.4.1") + implementation(libs.markdown) } diff --git a/build.gradle.kts b/build.gradle.kts index e162d51d..89d27215 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ plugins { - id("com.android.application") version "8.0.2" apply false - id("org.jetbrains.kotlin.android") version "1.8.21" apply false - id("com.google.devtools.ksp") version "1.8.21-1.0.11" apply false + alias(libs.plugins.android.application) apply false + alias(libs.plugins.devtools) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.about.libraries) apply false } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..725dbca2 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,100 @@ +[versions] +ktx = "1.10.1" +viewmodel-lifecycle = "2.6.1" +splash-screen = "1.0.1" +compose-activity = "1.7.2" +paging = "3.1.1" +work-runtime = "2.8.1ō" +compose-bom = "2023.06.01" +accompanist = "0.30.1" +serialization = "1.5.1" +collection = "0.3.5" +room-version = "2.5.2" +patcher = "11.0.4" +apksign = "8.0.2" +bcpkix-jdk15on = "1.70" +koin-version = "3.4.2" +koin-version-compose = "3.4.5" +reimagined-navigation = "1.4.0" +ktor = "2.3.2" +markdown = "0.4.1" +androidGradlePlugin = "8.0.2" +kotlinGradlePlugin = "1.8.21" +devToolsGradlePlugin = "1.8.21-1.0.11" +aboutLibrariesGradlePlugin = "10.8.0" +coil = "2.4.0" +app-icon-loader-coil = "1.5.0" +skrapeit = "1.1.5" +[libraries] +# AndroidX Core +androidx-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "ktx" } +runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "viewmodel-lifecycle" } +runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "viewmodel-lifecycle" } +splash-screen = { group = "androidx.core", name = "core-splashscreen", version.ref = "splash-screen" } +compose-activity = { group = "androidx.activity", name = "activity-compose", version.ref = "compose-activity" } +paging-common-ktx = { group = "androidx.paging", name = "paging-common-ktx", version.ref = "paging" } +work-runtime-ktx = { group = "androidx.work", name = "work-runtime-ktx", version.ref = "work-runtime" } + +# Compose +compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" } +compose-ui = { group = "androidx.compose.ui", name = "ui" } +compose-ui-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } +compose-livedata = { group = "androidx.compose.runtime", name = "runtime-livedata" } +compose-material3 = { group = "androidx.compose.material3", name = "material3" } +compose-material-icons-extended = { group = "androidx.compose.material", name = "material-icons-extended" } + +# Coil +coil-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil" } +coil-appiconloader = { group = "me.zhanghai.android.appiconloader", name = "appiconloader-coil", version.ref = "app-icon-loader-coil" } + +# Accompanist +accompanist-drawablepainter = { group = "com.google.accompanist", name = "accompanist-drawablepainter", version.ref = "accompanist" } +accompanist-webview = { group = "com.google.accompanist", name = "accompanist-webview", version.ref = "accompanist" } +accompanist-permissions = { group = "com.google.accompanist", name = "accompanist-permissions", version.ref = "accompanist" } +accompanist-systemuicontroller = { group = "com.google.accompanist", name = "accompanist-systemuicontroller", version.ref = "accompanist" } +accompanist-placeholder = { group = "com.google.accompanist", name = "accompanist-placeholder-material", version.ref = "accompanist" } + +# Kotlinx +kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serialization" } +kotlinx-collection-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "collection" } + +# Room +room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room-version" } +room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room-version" } +room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room-version" } + +# Patcher +patcher = { group = "app.revanced", name = "revanced-patcher", version.ref = "patcher" } + +# Signing +apksign = { group = "com.android.tools.build", name = "apksig", version.ref = "apksign" } +bcpkix-jdk15on = { group = "org.bouncycastle", name = "bcpkix-jdk15on", version.ref = "bcpkix-jdk15on" } + +# Koin +koin-android = { group = "io.insert-koin", name = "koin-android", version.ref = "koin-version" } +koin-compose = { group = "io.insert-koin", name = "koin-androidx-compose", version.ref = "koin-version-compose" } +koin-workmanager = { group = "io.insert-koin", name = "koin-androidx-workmanager", version.ref = "koin-version" } + +# Compose Navigation +reimagined-navigation = { group = "dev.olshevski.navigation", name = "reimagined", version.ref = "reimagined-navigation" } + +# about-libraries +about-libraries = { group = "com.mikepenz", name = "aboutlibraries-compose", version.ref = "aboutLibrariesGradlePlugin" } + +# Ktor +ktor-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor" } +ktor-logging = { group = "io.ktor", name = "ktor-client-logging", version.ref = "ktor" } +ktor-okhttp = { group = "io.ktor", name = "ktor-client-okhttp", version.ref = "ktor" } +ktor-content-negotiation = { group = "io.ktor", name = "ktor-client-content-negotiation", version.ref = "ktor" } +ktor-serialization = { group = "io.ktor", name = "ktor-serialization-kotlinx-json", version.ref = "ktor" } + +# HTML Scraper +skrapeit= { group = "it.skrape", name = "skrapeit", version.ref = "skrapeit" } +# Markdown +markdown = { group = "org.jetbrains", name = "markdown", version.ref = "markdown" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinGradlePlugin" } +devtools = { id = "com.google.devtools.ksp", version.ref = "devToolsGradlePlugin" } +about-libraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutLibrariesGradlePlugin" } \ No newline at end of file