From 74bb49ddb5bfe89e58262c611c0be7be2b623f63 Mon Sep 17 00:00:00 2001 From: Matt Ramotar Date: Wed, 5 Jul 2023 18:31:37 -0400 Subject: [PATCH] Migrate to version catalogs (#561) Signed-off-by: Matt Ramotar --- build.gradle.kts | 21 +++---- buildSrc/build.gradle.kts | 7 --- buildSrc/src/main/kotlin/Deps.kt | 75 ------------------------ buildSrc/src/main/kotlin/Version.kt | 37 ------------ cache/build.gradle.kts | 6 +- gradle.properties | 2 +- gradle/libs.versions.toml | 48 +++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 3 +- multicast/build.gradle.kts | 8 +-- rx2/build.gradle.kts | 18 +++--- store/build.gradle.kts | 25 ++++---- 11 files changed, 83 insertions(+), 167 deletions(-) delete mode 100644 buildSrc/build.gradle.kts delete mode 100644 buildSrc/src/main/kotlin/Deps.kt delete mode 100644 buildSrc/src/main/kotlin/Version.kt create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle.kts b/build.gradle.kts index 55d5e64..6c7def3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,18 +11,15 @@ buildscript { } dependencies { - classpath("com.android.tools.build:gradle:${Version.androidGradlePlugin}") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Version.baseKotlin}") - classpath("org.jetbrains.kotlin:kotlin-serialization:${Version.baseKotlin}") - classpath("org.jetbrains.dokka:dokka-gradle-plugin:${Version.dokkaGradlePlugin}") - classpath("org.jlleitschuh.gradle:ktlint-gradle:${Version.ktlintGradle}") - classpath("com.diffplug.spotless:spotless-plugin-gradle:${Version.spotlessPluginGradle}") - classpath("org.jacoco:org.jacoco.core:${Version.jacocoGradlePlugin}") - classpath("com.vanniktech:gradle-maven-publish-plugin:${Version.mavenPublishPlugin}") - classpath("org.jetbrains.kotlinx:kover:${Version.kover}") - classpath("com.squareup.anvil:gradle-plugin:${Version.anvilGradlePlugin}") - classpath("com.squareup.sqldelight:gradle-plugin:${Version.sqlDelightGradlePlugin}") - classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${Version.atomicFu}") + classpath(libs.android.gradle.plugin) + classpath(libs.kotlin.gradle.plugin) + classpath(libs.kotlin.serialization.plugin) + classpath(libs.dokka.gradle.plugin) + classpath(libs.ktlint.gradle.plugin) + classpath(libs.jacoco.gradle.plugin) + classpath(libs.maven.publish.plugin) + classpath(libs.kover.plugin) + classpath(libs.atomic.fu.gradle.plugin) } } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index b22ed73..0000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,7 +0,0 @@ -plugins { - `kotlin-dsl` -} - -repositories { - mavenCentral() -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Deps.kt b/buildSrc/src/main/kotlin/Deps.kt deleted file mode 100644 index 507a869..0000000 --- a/buildSrc/src/main/kotlin/Deps.kt +++ /dev/null @@ -1,75 +0,0 @@ -object Deps { - - object Androidx { - const val lifecycleRuntimeKtx = "androidx.lifecycle:lifecycle-runtime-ktx:${Version.lifecycleRuntimeKtx}" - const val lifecycleViewmodelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:${Version.lifecycleViewmodelKtx}" - const val activityCompose = "androidx.activity:activity-compose:${Version.activityCompose}" - const val appCompat = "androidx.appcompat:appcompat:1.4.1" - const val coreKtx = "androidx.core:core-ktx:1.7.0" - const val navigationCompose = "androidx.navigation:navigation-compose:${Version.navigationCompose}" - } - - object Coil { - const val compose = "io.coil-kt:coil-compose:2.2.2" - } - - object Compose { - const val compiler = "androidx.compose.compiler:compiler:${Version.composeCompiler}" - const val runtime = "androidx.compose.runtime:runtime:${Version.composeAndroidX}" - const val ui = "androidx.compose.ui:ui:${Version.composeAndroidX}" - const val uiGraphics = "androidx.compose.ui:ui-graphics:${Version.composeAndroidX}" - const val uiTooling = "androidx.compose.ui:ui-tooling:${Version.composeAndroidX}" - const val foundationLayout = "androidx.compose.foundation:foundation-layout:${Version.composeAndroidX}" - const val material = "androidx.compose.material:material:${Version.composeAndroidX}" - } - - object Dagger { - const val dagger = "com.google.dagger:dagger:${Version.dagger}" - const val daggerCompiler = "com.google.dagger:dagger-compiler:${Version.dagger}" - } - - object Kotlin { - const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Version.baseKotlin}" - } - - object Kotlinx { - const val atomicFu = "org.jetbrains.kotlinx:atomicfu:${Version.atomicFu}" - const val stdLib = "org.jetbrains.kotlin:kotlin-stdlib:${Version.baseKotlin}" - const val serializationCore = "org.jetbrains.kotlinx:kotlinx-serialization-core:${Version.kotlinxSerialization}" - const val serializationJson = "org.jetbrains.kotlinx:kotlinx-serialization-json:${Version.kotlinxSerialization}" - const val coroutinesAndroid = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Version.kotlinxCoroutines}" - const val coroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Version.kotlinxCoroutines}" - const val coroutinesRx2 = "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:${Version.kotlinxCoroutines}" - const val dateTime = "org.jetbrains.kotlinx:kotlinx-datetime:0.4.0" - } - - object Ktor { - const val clientCore = "io.ktor:ktor-client-core:${Version.ktor}" - const val clientCio = "io.ktor:ktor-client-cio:${Version.ktor}" - } - - object Rx { - const val rx2 = "io.reactivex.rxjava2:rxjava:2.2.21" - } - - object SqlDelight { - const val gradlePlugin = "com.squareup.sqldelight:gradle-plugin:${Version.sqlDelight}" - const val driverAndroid = "com.squareup.sqldelight:android-driver:${Version.sqlDelight}" - const val driverNative = "com.squareup.sqldelight:native-driver:${Version.sqlDelight}" - const val driverSqlite = "com.squareup.sqldelight:sqlite-driver:${Version.sqlDelight}" - const val runtime = "com.squareup.sqldelight:runtime:${Version.sqlDelight}" - const val coroutineExtensions = "com.squareup.sqldelight:coroutines-extensions:${Version.sqlDelight}" - const val driverNativeMacOS = "com.squareup.sqldelight:native-driver-macosx64:${Version.sqlDelight}" - } - - object Test { - const val core = "androidx.test:core:${Version.testCore}" - const val coroutinesTest = "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Version.kotlinxCoroutines}" - const val junit = "junit:junit:${Version.junit}" - const val truth = "com.google.truth:truth:${Version.truth}" - } - - object Touchlab { - const val kermit = "co.touchlab:kermit:${Version.kermit}" - } -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Version.kt b/buildSrc/src/main/kotlin/Version.kt deleted file mode 100644 index 8228028..0000000 --- a/buildSrc/src/main/kotlin/Version.kt +++ /dev/null @@ -1,37 +0,0 @@ -object Version { - const val activityCompose = "1.4.0-beta01" - const val androidMinSdk = 24 - const val androidCompileSdk = 33 - const val androidGradlePlugin = "7.2.2" - const val androidTargetSdk = androidCompileSdk - const val anvilGradlePlugin = "2.4.2" - const val atomicFu = "0.18.5" - const val baseKotlin = "1.7.21" - const val binaryCompatibilityValidator = "0.12.1" - const val composeAndroidX = "1.3.0-beta02" - const val composeJetbrains = "1.2.0-alpha01-dev755" - const val composeCompiler = "1.4.0-alpha02" - const val dagger = "2.44" - const val dokkaGradlePlugin = "1.6.0" - const val ktlintGradle = "10.2.1" - const val ktor = "2.1.1" - const val lifecycleKtx = "2.4.0-rc01" - const val lifecycleRuntimeKtx = lifecycleKtx - const val lifecycleViewmodelKtx = lifecycleKtx - const val jacocoGradlePlugin = "0.8.7" - const val mavenPublishPlugin = "0.22.0" - const val spotlessPluginGradle = "6.4.1" - const val junit = "4.13.2" - const val kotlinxCoroutines = "1.6.4" - const val kotlinxSerialization = "1.4.0" - const val kermit = "1.2.2" - const val testCore = "1.4.0" - const val kmmBridge = "0.3.2" - const val ktlint = "0.39.0" - const val kover = "0.6.0" - const val navigationCompose = "2.5.2" - const val sqlDelight = "1.5.4" - const val sqlDelightGradlePlugin = sqlDelight - const val store = "5.0.0-beta01" - const val truth = "1.1.3" -} \ No newline at end of file diff --git a/cache/build.gradle.kts b/cache/build.gradle.kts index a711c4c..15527d9 100644 --- a/cache/build.gradle.kts +++ b/cache/build.gradle.kts @@ -30,7 +30,7 @@ kotlin { summary = "Cache5" homepage = "https://github.com/MobileNativeFoundation/Store" ios.deploymentTarget = "13" - version = Version.store + version = libs.versions.store.get() } sourceSets { @@ -43,9 +43,7 @@ kotlin { val commonMain by getting { dependencies { - with(Deps.Kotlinx) { - api(atomicFu) - } + api(libs.kotlinx.atomic.fu) } } val jvmMain by getting diff --git a/gradle.properties b/gradle.properties index 51dac28..81bb606 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.jvmargs=-XX:MaxMetaspaceSize=2G # POM file GROUP=org.mobilenativefoundation.store -VERSION_NAME=5.0.0-beta01 +VERSION_NAME=5.0.0-SNAPSHOT POM_PACKAGING=pom POM_DESCRIPTION = Store5 is a Kotlin Multiplatform network-resilient repository layer diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..884e1c1 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,48 @@ +[versions] +androidMinSdk = "24" +androidCompileSdk = "33" +androidGradlePlugin = "7.4.2" +androidTargetSdk = "33" +atomicFu = "0.20.2" +baseKotlin = "1.8.21" +dokkaGradlePlugin = "1.6.0" +ktlintGradle = "10.2.1" +jacocoGradlePlugin = "0.8.7" +mavenPublishPlugin = "0.22.0" +spotlessPluginGradle = "6.4.1" +junit = "4.13.2" +kotlinxCoroutines = "1.7.1" +kotlinxSerialization = "1.5.1" +kermit = "1.2.2" +testCore = "1.5.0" +kmmBridge = "0.3.2" +ktlint = "0.39.0" +kover = "0.6.0" +store = "5.0.0-beta01" +truth = "1.1.3" + +[libraries] +android-gradle-plugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } +kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "baseKotlin" } +kotlin-serialization-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-serialization", version.ref = "baseKotlin" } +dokka-gradle-plugin = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "dokkaGradlePlugin" } +ktlint-gradle-plugin = { group = "org.jlleitschuh.gradle", name = "ktlint-gradle", version.ref = "ktlintGradle" } +jacoco-gradle-plugin = { group = "org.jacoco", name = "org.jacoco.core", version.ref = "jacocoGradlePlugin" } +maven-publish-plugin = { group = "com.vanniktech", name = "gradle-maven-publish-plugin", version.ref = "mavenPublishPlugin" } +kover-plugin = { group = "org.jetbrains.kotlinx", name = "kover", version.ref = "kover" } +atomic-fu-gradle-plugin = { group = "org.jetbrains.kotlinx", name = "atomicfu-gradle-plugin", version.ref = "atomicFu" } + +kotlinx-atomic-fu = { group = "org.jetbrains.kotlinx", name = "atomicfu", version.ref = "atomicFu" } +kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "baseKotlin" } +kotlinx-serialization-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-core", version.ref = "kotlinxSerialization" } +kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerialization" } +kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinxCoroutines" } +kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" } +kotlinx-coroutines-rx2 = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-rx2", version.ref = "kotlinxCoroutines" } +kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version = "0.4.0" } +rxjava = { group = "io.reactivex.rxjava2", name = "rxjava", version = "2.2.21" } +androidx-test-core = { group = "androidx.test", name = "core", version.ref = "testCore" } +kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" } +junit = { group = "junit", name = "junit", version.ref = "junit" } +google-truth = { group = "com.google.truth", name = "truth", version.ref = "truth" } +touchlab-kermit = { group = "co.touchlab", name = "kermit", version.ref = "kermit" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 00e33ed..3e9de8f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Sat Jun 17 09:25:41 EDT 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/multicast/build.gradle.kts b/multicast/build.gradle.kts index 93a1882..28db9f2 100644 --- a/multicast/build.gradle.kts +++ b/multicast/build.gradle.kts @@ -30,7 +30,7 @@ kotlin { summary = "Multicast5" homepage = "https://github.com/MobileNativeFoundation/Store" ios.deploymentTarget = "13" - version = Version.store + version = libs.versions.store.get() } sourceSets { @@ -43,10 +43,8 @@ kotlin { val commonMain by getting { dependencies { - with(Deps.Kotlinx) { - api(atomicFu) - implementation(coroutinesCore) - } + api(libs.kotlinx.atomic.fu) + implementation(libs.kotlinx.coroutines.core) } } val jvmMain by getting diff --git a/rx2/build.gradle.kts b/rx2/build.gradle.kts index b639f15..b41c0ab 100644 --- a/rx2/build.gradle.kts +++ b/rx2/build.gradle.kts @@ -14,19 +14,17 @@ plugins { } dependencies { - implementation(Deps.Kotlinx.coroutinesRx2) - implementation(Deps.Kotlinx.coroutinesCore) - implementation(Deps.Kotlinx.coroutinesAndroid) - implementation(Deps.Rx.rx2) + implementation(libs.kotlinx.coroutines.rx2) + implementation(libs.kotlinx.coroutines.core) + implementation(libs.kotlinx.coroutines.android) + implementation(libs.rxjava) implementation(project(":store")) testImplementation(kotlin("test")) - with(Deps.Test) { - testImplementation(junit) - testImplementation(core) - testImplementation(coroutinesTest) - testImplementation(truth) - } + testImplementation(libs.junit) + testImplementation(libs.google.truth) + testImplementation(libs.androidx.test.core) + testImplementation(libs.kotlinx.coroutines.test) } android { diff --git a/store/build.gradle.kts b/store/build.gradle.kts index 0dfcb6f..68813da 100644 --- a/store/build.gradle.kts +++ b/store/build.gradle.kts @@ -10,7 +10,7 @@ plugins { id("com.vanniktech.maven.publish") id("org.jetbrains.dokka") id("org.jetbrains.kotlinx.kover") - id("co.touchlab.faktory.kmmbridge") version Version.kmmBridge + id("co.touchlab.faktory.kmmbridge") version("0.3.2") `maven-publish` kotlin("native.cocoapods") id("kotlinx-atomicfu") @@ -35,7 +35,7 @@ kotlin { summary = "Store5" homepage = "https://github.com/MobileNativeFoundation/Store" ios.deploymentTarget = "13" - version = Version.store + version = libs.versions.store.get() } sourceSets { @@ -48,14 +48,12 @@ kotlin { val commonMain by getting { dependencies { - with(Deps.Kotlinx) { - implementation(stdLib) - implementation(coroutinesCore) - implementation(serializationCore) - implementation(dateTime) - api(atomicFu) - } - implementation(Deps.Touchlab.kermit) + implementation(libs.kotlin.stdlib) + implementation(libs.kotlinx.coroutines.core) + implementation(libs.kotlinx.serialization.core) + implementation(libs.kotlinx.datetime) + api(libs.kotlinx.atomic.fu) + implementation(libs.touchlab.kermit) implementation(project(":multicast")) implementation(project(":cache")) } @@ -65,11 +63,8 @@ kotlin { dependsOn(commonMain) dependencies { implementation(kotlin("test")) - with(Deps.Test) { - implementation(junit) - implementation(core) - implementation(coroutinesTest) - } + implementation(libs.junit) + implementation(libs.kotlinx.coroutines.test) } }