Kaynağa Gözat

Use Version Catalog & clean up Gradle files (#6728)

Andreas 3 yıl önce
ebeveyn
işleme
f312936629

+ 59 - 126
app/build.gradle.kts

@@ -1,8 +1,4 @@
 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-import java.io.ByteArrayOutputStream
-import java.text.SimpleDateFormat
-import java.util.Date
-import java.util.TimeZone
 
 plugins {
     id("com.android.application")
@@ -13,7 +9,7 @@ plugins {
 }
 
 if (gradle.startParameter.taskRequests.toString().contains("Standard")) {
-    apply(plugin = "com.google.gms.google-services")
+    apply<com.google.gms.googleservices.GoogleServicesPlugin>()
 }
 
 shortcutHelper.setFilePath("./shortcuts.xml")
@@ -137,153 +133,122 @@ android {
 }
 
 dependencies {
-    implementation(kotlin("reflect", version = BuildPluginsVersion.KOTLIN))
+    implementation(kotlinx.reflect)
 
-    val coroutinesVersion = "1.6.0"
-    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
-    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
+    implementation(kotlinx.bundles.coroutines)
 
     // Source models and interfaces from Tachiyomi 1.x
-    implementation("org.tachiyomi:source-api:1.1")
+    implementation(libs.tachiyomi.api)
 
     // AndroidX libraries
-    implementation("androidx.annotation:annotation:1.4.0-alpha02")
-    implementation("androidx.appcompat:appcompat:1.4.1")
-    implementation("androidx.biometric:biometric-ktx:1.2.0-alpha04")
-    implementation("androidx.browser:browser:1.4.0")
-    implementation("androidx.constraintlayout:constraintlayout:2.1.3")
-    implementation("androidx.coordinatorlayout:coordinatorlayout:1.2.0")
-    implementation("androidx.core:core-ktx:1.8.0-alpha04")
-    implementation("androidx.core:core-splashscreen:1.0.0-alpha02")
-    implementation("androidx.recyclerview:recyclerview:1.3.0-alpha01")
-    implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01")
-    implementation("androidx.viewpager:viewpager:1.1.0-alpha01")
-
-    val lifecycleVersion = "2.5.0-alpha02"
-    implementation("androidx.lifecycle:lifecycle-common:$lifecycleVersion")
-    implementation("androidx.lifecycle:lifecycle-process:$lifecycleVersion")
-    implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion")
+    implementation(androidx.annotation)
+    implementation(androidx.appcompat)
+    implementation(androidx.biometricktx)
+    implementation(androidx.browser)
+    implementation(androidx.constraintlayout)
+    implementation(androidx.coordinatorlayout)
+    implementation(androidx.corektx)
+    implementation(androidx.splashscreen)
+    implementation(androidx.recyclerview)
+    implementation(androidx.swiperefreshlayout)
+    implementation(androidx.viewpager)
+
+    implementation(androidx.bundles.lifecycle)
 
     // Job scheduling
-    implementation("androidx.work:work-runtime-ktx:2.6.0")
+    implementation(androidx.work.runtime)
 
     // RX
-    implementation("io.reactivex:rxandroid:1.2.1")
-    implementation("io.reactivex:rxjava:1.3.8")
-    implementation("com.jakewharton.rxrelay:rxrelay:1.2.0")
-    implementation("ru.beryukhov:flowreactivenetwork:1.0.4")
+    implementation(libs.bundles.reactivex)
+    implementation(libs.flowreactivenetwork)
 
     // Network client
-    val okhttpVersion = "4.9.1"
-    implementation("com.squareup.okhttp3:okhttp:$okhttpVersion")
-    implementation("com.squareup.okhttp3:logging-interceptor:$okhttpVersion")
-    implementation("com.squareup.okhttp3:okhttp-dnsoverhttps:$okhttpVersion")
-    implementation("com.squareup.okio:okio:3.0.0")
+    implementation(libs.bundles.okhttp)
+    implementation(libs.okio)
 
     // TLS 1.3 support for Android < 10
-    implementation("org.conscrypt:conscrypt-android:2.5.2")
+    implementation(libs.conscrypt.android)
 
     // Data serialization (JSON, protobuf)
-    val kotlinSerializationVersion = "1.3.2"
-    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinSerializationVersion")
-    implementation("org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$kotlinSerializationVersion")
+    implementation(kotlinx.bundles.serialization)
 
     // JavaScript engine
-    implementation("app.cash.quickjs:quickjs-android:0.9.2")
-    // TODO: remove Duktape once all extensions are using QuickJS
-    implementation("com.squareup.duktape:duktape-android:1.4.0")
+    implementation(libs.bundles.js.engine)
 
     // HTML parser
-    implementation("org.jsoup:jsoup:1.14.3")
+    implementation(libs.jsoup)
 
     // Disk
-    implementation("com.jakewharton:disklrucache:2.0.2")
-    implementation("com.github.tachiyomiorg:unifile:17bec43")
-    implementation("com.github.junrar:junrar:7.4.0")
+    implementation(libs.disklrucache)
+    implementation(libs.unifile)
+    implementation(libs.junrar)
 
     // Database
-    implementation("androidx.sqlite:sqlite-ktx:2.2.0")
+    implementation(libs.bundles.sqlite)
     implementation("com.github.inorichi.storio:storio-common:8be19de@aar")
     implementation("com.github.inorichi.storio:storio-sqlite:8be19de@aar")
-    implementation("com.github.requery:sqlite-android:3.36.0")
 
     // Preferences
-    implementation("androidx.preference:preference-ktx:1.2.0")
-    implementation("com.fredporciuncula:flow-preferences:1.6.0")
+    implementation(libs.preferencektx)
+    implementation(libs.flowpreferences)
 
     // Model View Presenter
-    val nucleusVersion = "3.0.0"
-    implementation("info.android15.nucleus:nucleus:$nucleusVersion")
-    implementation("info.android15.nucleus:nucleus-support-v7:$nucleusVersion")
+    implementation(libs.bundles.nucleus)
 
     // Dependency injection
-    implementation("com.github.inorichi.injekt:injekt-core:65b0440")
+    implementation(libs.injekt.core)
 
     // Image loading
-    val coilVersion = "1.4.0"
-    implementation("io.coil-kt:coil:$coilVersion")
-    implementation("io.coil-kt:coil-gif:$coilVersion")
+    implementation(libs.bundles.coil)
 
-    implementation("com.github.tachiyomiorg:subsampling-scale-image-view:846abe0") {
+    implementation(libs.subsamplingscaleimageview) {
         exclude(module = "image-decoder")
     }
-    implementation("com.github.tachiyomiorg:image-decoder:7481a4a")
+    implementation(libs.image.decoder)
 
     // Sort
-    implementation("com.github.gpanther:java-nat-sort:natural-comparator-1.1")
+    implementation(libs.natural.comparator)
 
     // UI libraries
-    implementation("com.google.android.material:material:1.6.0-alpha03")
-    implementation("com.github.dmytrodanylyk.android-process-button:library:1.0.4")
-    implementation("com.github.arkon.FlexibleAdapter:flexible-adapter:c8013533")
-    implementation("com.github.arkon.FlexibleAdapter:flexible-adapter-ui:c8013533")
-    implementation("com.nightlynexus.viewstatepageradapter:viewstatepageradapter:1.1.0")
-    implementation("com.github.chrisbanes:PhotoView:2.3.0")
-    implementation("com.github.tachiyomiorg:DirectionalViewPager:1.0.0") {
+    implementation(libs.material)
+    implementation(libs.androidprocessbutton)
+    implementation(libs.flexible.adapter.core)
+    implementation(libs.flexible.adapter.ui)
+    implementation(libs.viewstatepageradapter)
+    implementation(libs.photoview)
+    implementation(libs.directionalviewpager) {
         exclude(group = "androidx.viewpager", module = "viewpager")
     }
-    implementation("dev.chrisbanes.insetter:insetter:0.6.1")
+    implementation(libs.insetter)
 
     // Conductor
-    val conductorVersion = "3.1.2"
-    implementation("com.bluelinelabs:conductor:$conductorVersion")
-    implementation("com.bluelinelabs:conductor-viewpager:$conductorVersion")
-    implementation("com.github.tachiyomiorg:conductor-support-preference:$conductorVersion")
+    implementation(libs.bundles.conductor)
 
     // FlowBinding
-    val flowbindingVersion = "1.2.0"
-    implementation("io.github.reactivecircus.flowbinding:flowbinding-android:$flowbindingVersion")
-    implementation("io.github.reactivecircus.flowbinding:flowbinding-appcompat:$flowbindingVersion")
-    implementation("io.github.reactivecircus.flowbinding:flowbinding-recyclerview:$flowbindingVersion")
-    implementation("io.github.reactivecircus.flowbinding:flowbinding-swiperefreshlayout:$flowbindingVersion")
-    implementation("io.github.reactivecircus.flowbinding:flowbinding-viewpager:$flowbindingVersion")
+    implementation(libs.bundles.flowbinding)
 
     // Logging
-    implementation("com.squareup.logcat:logcat:0.1")
+    implementation(libs.logcat)
 
     // Crash reports/analytics
-    implementation("ch.acra:acra-http:5.8.4")
-    "standardImplementation"("com.google.firebase:firebase-analytics-ktx:20.0.2")
+    implementation(libs.acra.http)
+    "standardImplementation"(libs.firebase.analytics)
 
     // Licenses
-    implementation("com.mikepenz:aboutlibraries-core:${BuildPluginsVersion.ABOUTLIB_PLUGIN}")
+    implementation(libs.aboutlibraries.core)
 
     // Shizuku
-    val shizukuVersion = "12.1.0"
-    implementation("dev.rikka.shizuku:api:$shizukuVersion")
-    implementation("dev.rikka.shizuku:provider:$shizukuVersion")
+    implementation(libs.bundles.shizuku)
 
     // Tests
-    testImplementation("junit:junit:4.13.2")
-    testImplementation("org.assertj:assertj-core:3.16.1")
-    testImplementation("org.mockito:mockito-core:1.10.19")
+    testImplementation(libs.junit)
+    testImplementation(libs.assertj.core)
+    testImplementation(libs.mockito.core)
 
-    val robolectricVersion = "3.1.4"
-    testImplementation("org.robolectric:robolectric:$robolectricVersion")
-    testImplementation("org.robolectric:shadows-play-services:$robolectricVersion")
+    testImplementation(libs.bundles.robolectric)
 
     // For detecting memory leaks; see https://square.github.io/leakcanary/
-    // debugImplementation("com.squareup.leakcanary:leakcanary-android:2.7")
+    // debugImplementation(libs.leakcanary.android)
 }
 
 tasks {
@@ -313,40 +278,8 @@ tasks {
     }
 }
 
-
 buildscript {
-    repositories {
-        mavenCentral()
-    }
     dependencies {
-        classpath(kotlin("gradle-plugin", version = BuildPluginsVersion.KOTLIN))
-    }
-}
-
-
-// Git is needed in your system PATH for these commands to work.
-// If it's not installed, you can return a random value as a workaround
-fun getCommitCount(): String {
-    return runCommand("git rev-list --count HEAD")
-    // return "1"
-}
-
-fun getGitSha(): String {
-    return runCommand("git rev-parse --short HEAD")
-    // return "1"
-}
-
-fun getBuildTime(): String {
-    val df = SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
-    df.timeZone = TimeZone.getTimeZone("UTC")
-    return df.format(Date())
-}
-
-fun runCommand(command: String): String {
-    val byteOut = ByteArrayOutputStream()
-    project.exec {
-        commandLine = command.split(" ")
-        standardOutput = byteOut
+        classpath(kotlinx.gradle)
     }
-    return String(byteOut.toByteArray()).trim()
 }

+ 15 - 23
build.gradle.kts

@@ -1,21 +1,22 @@
-plugins {
-    id("com.android.application") version BuildPluginsVersion.AGP apply false
-    id("com.android.library") version BuildPluginsVersion.AGP apply false
-    kotlin("android") version BuildPluginsVersion.KOTLIN apply false
-    id("org.jmailen.kotlinter") version BuildPluginsVersion.KOTLINTER
-    id("com.github.ben-manes.versions") version BuildPluginsVersion.VERSIONS_PLUGIN
+buildscript {
+    dependencies {
+        classpath(libs.android.shortcut.gradle)
+        classpath(libs.google.services.gradle)
+        classpath(libs.aboutlibraries.gradle)
+        classpath(kotlinx.serialization.gradle)
+    }
 }
 
-allprojects {
-    repositories {
-        mavenCentral()
-        google()
-        maven { setUrl("https://www.jitpack.io") }
-    }
+plugins {
+    alias(androidx.plugins.application) apply false
+    alias(androidx.plugins.library) apply false
+    alias(kotlinx.plugins.android) apply false
+    alias(libs.plugins.kotlinter)
+    alias(libs.plugins.versionsx)
 }
 
 subprojects {
-    apply(plugin = "org.jmailen.kotlinter")
+    apply<org.jmailen.gradle.kotlinter.KotlinterPlugin>()
 
     kotlinter {
         experimentalRules = true
@@ -25,15 +26,6 @@ subprojects {
     }
 }
 
-buildscript {
-    dependencies {
-        classpath("com.github.zellius:android-shortcut-gradle-plugin:0.1.2")
-        classpath("com.google.gms:google-services:4.3.10")
-        classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:${BuildPluginsVersion.ABOUTLIB_PLUGIN}")
-        classpath(kotlin("serialization", version = BuildPluginsVersion.KOTLIN))
-    }
-}
-
-tasks.register("clean", Delete::class) {
+tasks.register<Delete>("clean") {
     delete(rootProject.buildDir)
 }

+ 32 - 0
buildSrc/src/main/kotlin/Commands.kt

@@ -0,0 +1,32 @@
+import org.gradle.api.Project
+import java.io.ByteArrayOutputStream
+import java.text.SimpleDateFormat
+import java.util.TimeZone
+import java.util.Date
+
+// Git is needed in your system PATH for these commands to work.
+// If it's not installed, you can return a random value as a workaround
+fun Project.getCommitCount(): String {
+    return runCommand("git rev-list --count HEAD")
+    // return "1"
+}
+
+fun Project.getGitSha(): String {
+    return runCommand("git rev-parse --short HEAD")
+    // return "1"
+}
+
+fun Project.getBuildTime(): String {
+    val df = SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
+    df.timeZone = TimeZone.getTimeZone("UTC")
+    return df.format(Date())
+}
+
+fun Project.runCommand(command: String): String {
+    val byteOut = ByteArrayOutputStream()
+    project.exec {
+        commandLine = command.split(" ")
+        standardOutput = byteOut
+    }
+    return String(byteOut.toByteArray()).trim()
+}

+ 0 - 7
buildSrc/src/main/kotlin/Dependencies.kt

@@ -1,7 +0,0 @@
-object BuildPluginsVersion {
-    const val AGP = "7.1.1"
-    const val KOTLIN = "1.6.10"
-    const val KOTLINTER = "3.6.0"
-    const val VERSIONS_PLUGIN = "0.42.0"
-    const val ABOUTLIB_PLUGIN = "8.9.4"
-}

+ 29 - 0
gradle/androidx.versions.toml

@@ -0,0 +1,29 @@
+[versions]
+agp_version = "7.1.1"
+lifecycle_version = "2.5.0-alpha02"
+
+[libraries]
+annotation = "androidx.annotation:annotation:1.4.0-alpha02"
+appcompat = "androidx.appcompat:appcompat:1.4.1"
+biometricktx = "androidx.biometric:biometric-ktx:1.2.0-alpha04"
+browser = "androidx.browser:browser:1.4.0"
+constraintlayout = "androidx.constraintlayout:constraintlayout:2.1.3"
+coordinatorlayout = "androidx.coordinatorlayout:coordinatorlayout:1.2.0"
+corektx = "androidx.core:core-ktx:1.8.0-alpha04"
+splashscreen = "androidx.core:core-splashscreen:1.0.0-alpha02"
+recyclerview = "androidx.recyclerview:recyclerview:1.3.0-alpha01"
+swiperefreshlayout = "androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01"
+viewpager = "androidx.viewpager:viewpager:1.1.0-alpha01"
+
+lifecycle-common = { module = "androidx.lifecycle:lifecycle-common", version.ref = "lifecycle_version" }
+lifecycle-process = { module = "androidx.lifecycle:lifecycle-process", version.ref = "lifecycle_version" }
+lifecycle-runtimektx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle_version" }
+
+work-runtime = "androidx.work:work-runtime-ktx:2.6.0"
+
+[bundles]
+lifecycle = ["lifecycle-common","lifecycle-process","lifecycle-runtimektx"]
+
+[plugins]
+application = { id = "com.android.application", version.ref="agp_version"}
+library = { id = "com.android.library", version.ref="agp_version"}

+ 23 - 0
gradle/kotlinx.versions.toml

@@ -0,0 +1,23 @@
+[versions]
+kotlin_version = "1.6.10"
+coroutines_version = "1.6.0"
+serialization_version = "1.3.2"
+
+[libraries]
+reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin_version" }
+gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin_version" }
+
+coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines_version" }
+coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines_version" }
+
+serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization_version" }
+serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "serialization_version" }
+serialization-gradle = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin_version"}
+
+[bundles]
+coroutines = ["coroutines-core", "coroutines-android"]
+serialization = ["serialization-json","serialization-protobuf"]
+
+[plugins]
+
+android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin_version"}

+ 111 - 0
gradle/libs.versions.toml

@@ -0,0 +1,111 @@
+[versions]
+aboutlib_version = "8.9.4"
+okhttp_version = "4.9.1"
+nucleus_version = "3.0.0"
+coil_version = "1.4.0"
+conductor_version = "3.1.2"
+flowbinding_version = "1.2.0"
+shizuku_version = "12.1.0"
+robolectric_version = "3.1.4"
+
+[libraries]
+android-shortcut-gradle = "com.github.zellius:android-shortcut-gradle-plugin:0.1.2"
+google-services-gradle = "com.google.gms:google-services:4.3.10"
+
+tachiyomi-api = "org.tachiyomi:source-api:1.1"
+
+rxandroid = "io.reactivex:rxandroid:1.2.1"
+rxjava = "io.reactivex:rxjava:1.3.8"
+rxrelay = "com.jakewharton.rxrelay:rxrelay:1.2.0"
+flowreactivenetwork = "ru.beryukhov:flowreactivenetwork:1.0.4"
+
+okhttp-core = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp_version" }
+okhttp-logging = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp_version" }
+okhttp-dnsoverhttps = { module = "com.squareup.okhttp3:okhttp-dnsoverhttps", version.ref = "okhttp_version" }
+okio = "com.squareup.okio:okio:3.0.0"
+
+conscrypt-android = "org.conscrypt:conscrypt-android:2.5.2"
+
+quickjs-android = "app.cash.quickjs:quickjs-android:0.9.2"
+# TODO: remove Duktape once all extensions are using QuickJS
+duktape-android = "com.squareup.duktape:duktape-android:1.4.0"
+
+jsoup = "org.jsoup:jsoup:1.14.3"
+
+disklrucache = "com.jakewharton:disklrucache:2.0.2"
+unifile = "com.github.tachiyomiorg:unifile:17bec43"
+junrar = "com.github.junrar:junrar:7.4.0"
+
+sqlitektx = "androidx.sqlite:sqlite-ktx:2.2.0"
+sqlite-android = "com.github.requery:sqlite-android:3.36.0"
+
+preferencektx = "androidx.preference:preference-ktx:1.2.0"
+flowpreferences = "com.fredporciuncula:flow-preferences:1.6.0"
+
+nucleus-core = { module = "info.android15.nucleus:nucleus", version.ref = "nucleus_version" }
+nucleus-supportv7 = { module = "info.android15.nucleus:nucleus-support-v7", version.ref = "nucleus_version" }
+
+injekt-core = "com.github.inorichi.injekt:injekt-core:65b0440"
+
+coil-core = { module = "io.coil-kt:coil", version.ref = "coil_version" }
+coil-gif = { module = "io.coil-kt:coil-gif", version.ref = "coil_version" }
+
+subsamplingscaleimageview = "com.github.tachiyomiorg:subsampling-scale-image-view:846abe0"
+image-decoder = "com.github.tachiyomiorg:image-decoder:7481a4a"
+
+natural-comparator = "com.github.gpanther:java-nat-sort:natural-comparator-1.1"
+
+material = "com.google.android.material:material:1.6.0-alpha03"
+androidprocessbutton = "com.github.dmytrodanylyk.android-process-button:library:1.0.4"
+flexible-adapter-core = "com.github.arkon.FlexibleAdapter:flexible-adapter:c8013533"
+flexible-adapter-ui = "com.github.arkon.FlexibleAdapter:flexible-adapter-ui:c8013533"
+viewstatepageradapter = "com.nightlynexus.viewstatepageradapter:viewstatepageradapter:1.1.0"
+photoview = "com.github.chrisbanes:PhotoView:2.3.0"
+directionalviewpager = "com.github.tachiyomiorg:DirectionalViewPager:1.0.0"
+insetter = "dev.chrisbanes.insetter:insetter:0.6.1"
+
+conductor-core = { module = "com.bluelinelabs:conductor", version.ref = "conductor_version" }
+conductor-viewpager = { module = "com.bluelinelabs:conductor-viewpager", version.ref = "conductor_version" }
+conductor-support-preference = { module = "com.github.tachiyomiorg:conductor-support-preference", version.ref = "conductor_version" }
+
+flowbinding-android = { module = "io.github.reactivecircus.flowbinding:flowbinding-android", version.ref = "flowbinding_version" }
+flowbinding-appcompat = { module = "io.github.reactivecircus.flowbinding:flowbinding-appcompat", version.ref = "flowbinding_version" }
+flowbinding-recyclerview = { module = "io.github.reactivecircus.flowbinding:flowbinding-recyclerview", version.ref = "flowbinding_version" }
+flowbinding-swiperefreshlayout = { module = "io.github.reactivecircus.flowbinding:flowbinding-swiperefreshlayout", version.ref = "flowbinding_version" }
+flowbinding-viewpager = { module = "io.github.reactivecircus.flowbinding:flowbinding-viewpager", version.ref = "flowbinding_version" }
+
+logcat = "com.squareup.logcat:logcat:0.1"
+
+acra-http = "ch.acra:acra-http:5.8.4"
+firebase-analytics = "com.google.firebase:firebase-analytics-ktx:20.0.2"
+
+aboutlibraries-core = { module = "com.mikepenz:aboutlibraries-core", version.ref = "aboutlib_version" }
+aboutlibraries-gradle = { module = "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin", version.ref = "aboutlib_version" }
+
+shizuku-api = { module = "dev.rikka.shizuku:api", version.ref = "shizuku_version" }
+shizuku-provider = { module = "dev.rikka.shizuku:provider", version.ref = "shizuku_version" }
+
+junit = "junit:junit:4.13.2"
+assertj-core = "org.assertj:assertj-core:3.16.1"
+mockito-core = "org.mockito:mockito-core:1.10.19"
+
+robolectric-core = { module = "org.robolectric:robolectric", version.ref = "robolectric_version" }
+robolectric-playservices = { module = "org.robolectric:shadows-play-services", version.ref = "robolectric_version" }
+
+leakcanary-android = "com.squareup.leakcanary:leakcanary-android:2.7"
+
+[bundles]
+reactivex = ["rxandroid","rxjava","rxrelay"]
+okhttp = ["okhttp-core","okhttp-logging","okhttp-dnsoverhttps"]
+js-engine = ["quickjs-android", "duktape-android"]
+sqlite = ["sqlitektx", "sqlite-android"]
+nucleus = ["nucleus-core","nucleus-supportv7"]
+coil = ["coil-core","coil-gif",]
+flowbinding = ["flowbinding-android","flowbinding-appcompat","flowbinding-recyclerview","flowbinding-swiperefreshlayout","flowbinding-viewpager"]
+conductor = ["conductor-core","conductor-viewpager","conductor-support-preference"]
+shizuku = ["shizuku-api","shizuku-provider"]
+robolectric = ["robolectric-core","robolectric-playservices"]
+
+[plugins]
+kotlinter = { id = "org.jmailen.kotlinter", version = "3.6.0"}
+versionsx = { id = "com.github.ben-manes.versions", version = "0.42.0"}

+ 21 - 4
settings.gradle.kts

@@ -1,10 +1,10 @@
+enableFeaturePreview("VERSION_CATALOGS")
+
 pluginManagement {
     resolutionStrategy {
         eachPlugin {
-            if (requested.id.id == "com.android.library") {
-                useModule("com.android.tools.build:gradle:${requested.version}")
-            }
-            if (requested.id.id == "com.android.application") {
+            val regex = "com.android.(library|application)".toRegex()
+            if (regex matches requested.id.id) {
                 useModule("com.android.tools.build:gradle:${requested.version}")
             }
         }
@@ -16,5 +16,22 @@ pluginManagement {
     }
 }
 
+dependencyResolutionManagement {
+    versionCatalogs {
+        create("kotlinx") {
+            from(files("gradle/kotlinx.versions.toml"))
+        }
+        create("androidx") {
+            from(files("gradle/androidx.versions.toml"))
+        }
+    }
+    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+    repositories {
+        mavenCentral()
+        google()
+        maven(url = "https://www.jitpack.io")
+    }
+}
+
 rootProject.name = "Tachiyomi"
 include(":app")