From 55f23a1ea85c893ea14f8cfc4a646f0615999157 Mon Sep 17 00:00:00 2001 From: John O'Reilly Date: Sun, 29 Oct 2023 18:55:20 +0000 Subject: [PATCH] WIP: transition to version catalogs --- app/build.gradle.kts | 12 +++---- buildSrc/src/main/java/Dependencies.kt | 45 +++++++++----------------- common/build.gradle.kts | 37 +++++++++------------ compose-ios/build.gradle.kts | 22 ++++--------- gradle/libs.versions.toml | 16 +++++++-- wearApp/build.gradle.kts | 8 ++--- 6 files changed, 61 insertions(+), 79 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 25b53051..6c1ceb49 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -86,13 +86,11 @@ dependencies { implementation(libs.androidx.compose.material3) implementation(Deps.Compose.coilCompose) - with(Deps.Koin) { - implementation(core) - implementation(android) - implementation(compose) - testImplementation(test) - testImplementation(testJUnit4) - } + implementation(libs.koin.core) + implementation(libs.koin.android) + implementation(libs.koin.androidx.compose) + implementation(libs.koin.test) + implementation(libs.koin.test.junit4) with(Deps.Test) { testImplementation(junit) diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index cbaa97c1..aef7feac 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -25,7 +25,6 @@ object Versions { const val mockito = "3.11.2" const val robolectric = "4.10" - const val sqlDelight = "2.0.0" const val shadow = "7.0.0" const val kotlinterGradle = "3.4.5" @@ -40,9 +39,8 @@ object Versions { const val kotlinReactRouterDom = "5.1.2-pre.110-kotlin-1.4.0" const val kotlinStyled = "5.2.1-pre.146-kotlin-1.4.30" - const val slf4j = "1.7.30" + //const val slf4j = "1.7.30" const val logback = "1.2.3" - const val kermit = "2.0.0-RC4" const val gradleVersionsPlugin = "0.39.0" } @@ -58,14 +56,14 @@ object Deps { object Gradle { const val kotlinter = "org.jmailen.gradle:kotlinter-gradle:${Versions.kotlinterGradle}" const val shadow = "gradle.plugin.com.github.jengelman.gradle.plugins:shadow:${Versions.shadow}" - const val sqlDelight = "app.cash.sqldelight:gradle-plugin:${Versions.sqlDelight}" + //const val sqlDelight = "app.cash.sqldelight:gradle-plugin:${Versions.sqlDelight}" const val gradleVersionsPlugin = "com.github.ben-manes:gradle-versions-plugin:${Versions.gradleVersionsPlugin}" } object Kotlinx { const val serializationCore = "org.jetbrains.kotlinx:kotlinx-serialization-core:${Versions.kotlinxSerialization}" const val coroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutines}" - const val coroutinesTest = "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.kotlinCoroutines}" + //const val coroutinesTest = "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.kotlinCoroutines}" const val htmlJs = "org.jetbrains.kotlinx:kotlinx-html-js:${Versions.kotlinxHtmlJs}" } @@ -112,13 +110,13 @@ object Deps { const val composeImageLoader = "io.github.qdsfdhvh:image-loader:1.2.9" } - object Koin { - const val core = "io.insert-koin:koin-core:${Versions.koinCore}" - const val test = "io.insert-koin:koin-test:${Versions.koinCore}" - const val testJUnit4 = "io.insert-koin:koin-test-junit4:${Versions.koinCore}" - const val android = "io.insert-koin:koin-android:${Versions.koinAndroid}" - const val compose = "io.insert-koin:koin-androidx-compose:${Versions.koinAndroidCompose}" - } +// object Koin { +// const val core = "io.insert-koin:koin-core:${Versions.koinCore}" +// const val test = "io.insert-koin:koin-test:${Versions.koinCore}" +// const val testJUnit4 = "io.insert-koin:koin-test-junit4:${Versions.koinCore}" +// const val android = "io.insert-koin:koin-android:${Versions.koinAndroid}" +// const val compose = "io.insert-koin:koin-androidx-compose:${Versions.koinAndroidCompose}" +// } object Ktor { const val serverCore = "io.ktor:ktor-server-core:${Versions.ktor}" @@ -132,21 +130,11 @@ object Deps { const val clientCore = "io.ktor:ktor-client-core:${Versions.ktor}" const val clientJson = "io.ktor:ktor-client-json:${Versions.ktor}" const val clientLogging = "io.ktor:ktor-client-logging:${Versions.ktor}" - const val clientSerialization = "io.ktor:ktor-client-serialization:${Versions.ktor}" - const val clientAndroid = "io.ktor:ktor-client-android:${Versions.ktor}" - const val clientJava = "io.ktor:ktor-client-java:${Versions.ktor}" - const val clientDarwin = "io.ktor:ktor-client-darwin:${Versions.ktor}" - const val clientJs = "io.ktor:ktor-client-js:${Versions.ktor}" - } - - object SqlDelight { - const val runtime = "app.cash.sqldelight:runtime:${Versions.sqlDelight}" - const val coroutineExtensions = "app.cash.sqldelight:coroutines-extensions:${Versions.sqlDelight}" - const val androidDriver = "app.cash.sqldelight:android-driver:${Versions.sqlDelight}" - const val nativeDriver = "app.cash.sqldelight:native-driver:${Versions.sqlDelight}" - //const val nativeDriverMacos = "app.cash.sqldelight:native-driver-macosx64:${Versions.sqlDelight}" - const val nativeDriverMacos = "app.cash.sqldelight:native-driver-macosarm64:${Versions.sqlDelight}" - const val sqliteDriver = "app.cash.sqldelight:sqlite-driver:${Versions.sqlDelight}" +// const val clientSerialization = "io.ktor:ktor-client-serialization:${Versions.ktor}" +// const val clientAndroid = "io.ktor:ktor-client-android:${Versions.ktor}" +// const val clientJava = "io.ktor:ktor-client-java:${Versions.ktor}" +// const val clientDarwin = "io.ktor:ktor-client-darwin:${Versions.ktor}" +// const val clientJs = "io.ktor:ktor-client-js:${Versions.ktor}" } object React { @@ -162,9 +150,8 @@ object Deps { } object Log { - const val slf4j = "org.slf4j:slf4j-simple:${Versions.slf4j}" + //const val slf4j = "org.slf4j:slf4j-simple:${Versions.slf4j}" const val logback = "ch.qos.logback:logback-classic:${Versions.logback}" - const val kermit = "co.touchlab:kermit:${Versions.kermit}" } object Glance { diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 5d8b9d74..c1d11b1c 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -36,7 +36,6 @@ kotlin { } } - applyDefaultHierarchyTemplate() //macosX64("macOS") @@ -60,24 +59,20 @@ kotlin { implementation(libs.kotlinx.coroutines) implementation(libs.kotlinx.serialization) - with(Deps.SqlDelight) { - implementation(runtime) - implementation(coroutineExtensions) - } + implementation(libs.sqldelight.runtime) + implementation(libs.sqldelight.coroutines.extensions) api(libs.koin.core) implementation(libs.koin.test) - with(Deps.Log) { - api(kermit) - } + api(libs.kermit) } } commonTest { dependencies { implementation(libs.koin.test) - implementation(Deps.Kotlinx.coroutinesTest) + implementation(libs.kotlinx.coroutines.test) implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) } @@ -85,43 +80,43 @@ kotlin { androidMain { dependencies { - implementation(Deps.Ktor.clientAndroid) - implementation(Deps.SqlDelight.androidDriver) + implementation(libs.ktor.client.android) + implementation(libs.sqldelight.android.driver) } } jvmMain { dependencies { - implementation(Deps.Ktor.clientJava) - implementation(Deps.SqlDelight.sqliteDriver) - implementation(Deps.Log.slf4j) + implementation(libs.ktor.client.java) + implementation(libs.sqldelight.sqlite.driver) + implementation(libs.slf4j) } } iosMain { dependencies { - implementation(Deps.Ktor.clientDarwin) - implementation(Deps.SqlDelight.nativeDriver) + implementation(libs.ktor.client.darwin) + implementation(libs.sqldelight.native.driver) } } watchosMain { dependencies { - implementation(Deps.Ktor.clientDarwin) - implementation(Deps.SqlDelight.nativeDriver) + implementation(libs.ktor.client.darwin) + implementation(libs.sqldelight.native.driver) } } macosMain{ dependencies { - implementation(Deps.Ktor.clientDarwin) - implementation(Deps.SqlDelight.nativeDriverMacos) + implementation(libs.ktor.client.darwin) + implementation(libs.sqldelight.native.driver.macos) } } jsMain { dependencies { - implementation(Deps.Ktor.clientJs) + implementation(libs.ktor.client.js) } } diff --git a/compose-ios/build.gradle.kts b/compose-ios/build.gradle.kts index fa7e6ee9..d3345385 100644 --- a/compose-ios/build.gradle.kts +++ b/compose-ios/build.gradle.kts @@ -73,21 +73,13 @@ kotlin { implementation(serializationCore) } - with(Deps.SqlDelight) { - implementation(runtime) - implementation(coroutineExtensions) - } - - with(Deps.Koin) { - api(core) - api(test) - } - - with(Deps.Log) { - api(kermit) - } + implementation(libs.sqldelight.runtime) + implementation(libs.sqldelight.coroutines.extensions) + api(libs.koin.core) + implementation(libs.koin.test) + implementation(libs.kermit) implementation(compose.ui) implementation(compose.foundation) @@ -105,8 +97,8 @@ kotlin { dependsOn(nativeMain) dependencies { - implementation(Deps.Ktor.clientDarwin) - implementation(Deps.SqlDelight.nativeDriver) + implementation(libs.ktor.client.darwin) + implementation(libs.sqldelight.native.driver) } } val uikitX64Main by getting { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5900dbe6..f5ae435e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -26,7 +26,7 @@ coilCompose = "2.4.0" junit = "4.13.2" multiplatformSettings = "1.0.0" -kermit = "1.2.2" +kermit = "2.0.2" gradleVersionsPlugin = "0.39.0" shadowPlugin = "7.0.0" @@ -70,6 +70,8 @@ koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" } koin-androidx-compose = { module = "io.insert-koin:koin-androidx-compose", version.ref = "koinCompose" } koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" } koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" } +koin-test-junit4 = { module = "io.insert-koin:koin-test-junit4", version.ref = "koin" } + ktor-client-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor" } ktor-client-json = { group = "io.ktor", name = "ktor-client-json", version.ref = "ktor" } @@ -77,11 +79,21 @@ ktor-client-logging = { group = "io.ktor", name = "ktor-client-logging", version ktor-client-serialization = { group = "io.ktor", name = "ktor-client-serialization", version.ref = "ktor" } ktor-client-content-negotiation = { group = "io.ktor", name = "ktor-client-content-negotiation", version.ref = "ktor" } ktor-client-android = { group = "io.ktor", name = "ktor-client-android", version.ref = "ktor" } -ktor-client-ios = { group = "io.ktor", name = "ktor-client-ios", version.ref = "ktor" } +ktor-client-darwin = { group = "io.ktor", name = "ktor-client-darwin", version.ref = "ktor" } ktor-client-java = { group = "io.ktor", name = "ktor-client-java", version.ref = "ktor" } +ktor-client-js = { group = "io.ktor", name = "ktor-client-js", version.ref = "ktor" } + ktor-serialization-kotlinx-json = { group = "io.ktor", name = "ktor-serialization-kotlinx-json", version.ref = "ktor" } slf4j = { group = "org.slf4j", name = "slf4j-simple", version.ref = "slf4j" } + +sqldelight-runtime = { module = "app.cash.sqldelight:runtime", version.ref = "sqlDelight" } +sqldelight-coroutines-extensions = { module = "app.cash.sqldelight:coroutines-extensions", version.ref = "sqlDelight" } +sqldelight-android-driver = { module = "app.cash.sqldelight:android-driver", version.ref = "sqlDelight" } +sqldelight-native-driver = { module = "app.cash.sqldelight:native-driver", version.ref = "sqlDelight" } +sqldelight-native-driver-macos = { module = "app.cash.sqldelight:native-driver-macosarm64", version.ref = "sqlDelight" } +sqldelight-sqlite-driver = { module = "app.cash.sqldelight:sqlite-driver", version.ref = "sqlDelight" } + multiplatform-settings = { module = "com.russhwolf:multiplatform-settings", version.ref = "multiplatformSettings" } multiplatform-settings-coroutines = { module = "com.russhwolf:multiplatform-settings-coroutines", version.ref = "multiplatformSettings" } kermit = { module = "co.touchlab:kermit", version.ref = "kermit" } diff --git a/wearApp/build.gradle.kts b/wearApp/build.gradle.kts index 46acfd51..dd9111d5 100644 --- a/wearApp/build.gradle.kts +++ b/wearApp/build.gradle.kts @@ -67,11 +67,9 @@ dependencies { } implementation(libs.androidx.compose.ui.tooling) - with(Deps.Koin) { - implementation(core) - implementation(android) - implementation(compose) - } + implementation(libs.koin.core) + implementation(libs.koin.android) + implementation(libs.koin.androidx.compose) with (Deps.Ok) { implementation(okhttp)