From fd115bf429a6b373076d4c1ab281fde27eeec9c2 Mon Sep 17 00:00:00 2001 From: Vitor Hugo Schwaab Date: Fri, 14 Jun 2024 16:03:16 +0200 Subject: [PATCH 1/6] chore: upgrade to kotlin 2.0 --- .gitignore | 3 +++ android/build.gradle.kts | 1 + build.gradle.kts | 2 ++ buildSrc/build.gradle.kts | 1 + buildSrc/src/main/kotlin/scripts/detekt.gradle.kts | 6 +++--- gradle/libs.versions.toml | 7 ++++--- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 853a71966eb..2fa2f349838 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,9 @@ native/ # Java class files *.class +# Kotlin files +.kotlin/ + # Generated files bin/ gen/ diff --git a/android/build.gradle.kts b/android/build.gradle.kts index f48cc43bfc0..f2ef85c4e43 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -20,6 +20,7 @@ plugins { id(libs.plugins.android.application.get().pluginId) id(libs.plugins.kotlin.android.get().pluginId) + alias(libs.plugins.compose.compiler) } android { diff --git a/build.gradle.kts b/build.gradle.kts index aff4e98c0e8..cb46c09cef9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -43,6 +43,7 @@ repositories { wireDetektRulesRepo() google() mavenCentral() + maven(url = "https://oss.sonatype.org/content/repositories/snapshots") } plugins { @@ -52,6 +53,7 @@ plugins { id("scripts.detekt") alias(libs.plugins.moduleGraph) alias(libs.plugins.completeKotlin) + alias(libs.plugins.compose.compiler) apply false } dependencies { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 17d1ce939d4..dd15b2633cf 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -24,6 +24,7 @@ plugins { repositories { google() mavenCentral() + maven(url = "https://oss.sonatype.org/content/repositories/snapshots") } dependencies { diff --git a/buildSrc/src/main/kotlin/scripts/detekt.gradle.kts b/buildSrc/src/main/kotlin/scripts/detekt.gradle.kts index 7d4d953b20a..bb93bdbe5ab 100644 --- a/buildSrc/src/main/kotlin/scripts/detekt.gradle.kts +++ b/buildSrc/src/main/kotlin/scripts/detekt.gradle.kts @@ -31,7 +31,7 @@ dependencies { detekt("io.gitlab.arturbosch.detekt:detekt-cli:$detektVersion") detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion") detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-libraries:$detektVersion") - detektPlugins("com.wire:detekt-rules:1.0.0-1.23.6") { + detektPlugins("com.wire:detekt-rules:2.0.0-main-SNAPSHOT") { isChanging = true } } @@ -39,7 +39,7 @@ dependencies { detekt { buildUponDefaultConfig = true // activate all available (even unstable) rules. - // allRules = false + allRules = false config.setFrom(files("$rootDir/detekt/detekt.yml")) source.setFrom(files("$rootDir")) // a way of suppressing issues before introducing detekt @@ -47,7 +47,7 @@ detekt { // dynamic prop to enable and disable autocorrect, enabled locally via local.properties file val autoFixEnabled = getLocalProperty("detektAutofix", "false") - autoCorrect = autoFixEnabled.toBoolean() + autoCorrect.set(autoFixEnabled.toBoolean()) println("> Detekt autoCorrect: $autoFixEnabled") } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4c57e6b8683..ee69c000200 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "1.9.23" +kotlin = "2.0.0" activity-compose = "1.9.0" app-compat = "1.6.1" android-paging3 = "3.2.1" @@ -43,7 +43,7 @@ core-crypto-multiplatform = "0.6.0-rc.3-multiplatform-pre1" completeKotlin = "1.1.0" desugar-jdk = "2.0.4" kermit = "2.0.3" -detekt = "1.23.6" +detekt = "main-SNAPSHOT" agp = "8.3.2" dokka = "1.8.20" carthage = "0.0.1" @@ -73,12 +73,13 @@ kalium-library = { id = "kalium.library" } android-library = { id = "com.android.library", version.ref = "agp" } android-application = { id = "com.android.application", version.ref = "agp" } completeKotlin = { id = "com.louiscad.complete-kotlin", version.ref = "completeKotlin" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } moduleGraph = { id = "dev.iurysouza.modulegraph", version.ref = "moduleGraph" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } -ksp = { id = "com.google.devtools.ksp", version = "1.9.23-1.0.20" } +ksp = { id = "com.google.devtools.ksp", version = "2.0.0-1.0.22" } carthage = { id = "com.wire.carthage-gradle-plugin", version.ref = "carthage" } sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" } protobuf = { id = "com.google.protobuf", version.ref = "protobufCodegen" } From 5c4f9e7fefb1809870f9dfce2c37bba28e82df97 Mon Sep 17 00:00:00 2001 From: Vitor Hugo Schwaab Date: Wed, 17 Jul 2024 19:26:26 +0200 Subject: [PATCH 2/6] chore: prepare for 2.0.0 --- build.gradle.kts | 1 - buildSrc/build.gradle.kts | 8 ++++++++ buildSrc/src/main/kotlin/scripts/detekt.gradle.kts | 14 +++++++++++--- gradle/libs.versions.toml | 2 +- .../logic/feature/UserSessionScopeProviderImpl.kt | 2 +- .../logic/feature/UserSessionScopeProvider.kt | 2 +- .../com.wire.kalium.util/KaliumDispatcherImpl.kt | 3 +-- 7 files changed, 23 insertions(+), 9 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index cb46c09cef9..8303612b975 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,6 @@ buildscript { classpath("org.jetbrains.dokka:dokka-gradle-plugin:${libs.versions.dokka.get()}") classpath("com.google.protobuf:protobuf-gradle-plugin:${libs.versions.protobufCodegen.get()}") classpath("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:${libs.versions.detekt.get()}") - classpath("io.gitlab.arturbosch.detekt:detekt-cli:${libs.versions.detekt.get()}") classpath("io.github.leandroborgesferreira:dag-command:${libs.versions.dagCommand.get()}") } } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index dd15b2633cf..a020c11105d 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -27,6 +27,14 @@ repositories { maven(url = "https://oss.sonatype.org/content/repositories/snapshots") } +configurations.all { + resolutionStrategy.eachDependency { + if (requested.group == "org.jetbrains.kotlin") { + useVersion(libs.versions.kotlin.get()) + } + } +} + dependencies { implementation(libs.kotlin.plugin) implementation("org.jetbrains.dokka:dokka-gradle-plugin:${libs.versions.dokka.get()}") diff --git a/buildSrc/src/main/kotlin/scripts/detekt.gradle.kts b/buildSrc/src/main/kotlin/scripts/detekt.gradle.kts index bb93bdbe5ab..00b1858d516 100644 --- a/buildSrc/src/main/kotlin/scripts/detekt.gradle.kts +++ b/buildSrc/src/main/kotlin/scripts/detekt.gradle.kts @@ -31,7 +31,7 @@ dependencies { detekt("io.gitlab.arturbosch.detekt:detekt-cli:$detektVersion") detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion") detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-libraries:$detektVersion") - detektPlugins("com.wire:detekt-rules:2.0.0-main-SNAPSHOT") { + detektPlugins("com.wire:detekt-rules:1.0.0-1.23.6") { isChanging = true } } @@ -39,7 +39,7 @@ dependencies { detekt { buildUponDefaultConfig = true // activate all available (even unstable) rules. - allRules = false + // allRules = false config.setFrom(files("$rootDir/detekt/detekt.yml")) source.setFrom(files("$rootDir")) // a way of suppressing issues before introducing detekt @@ -47,7 +47,7 @@ detekt { // dynamic prop to enable and disable autocorrect, enabled locally via local.properties file val autoFixEnabled = getLocalProperty("detektAutofix", "false") - autoCorrect.set(autoFixEnabled.toBoolean()) + autoCorrect = autoFixEnabled.toBoolean() println("> Detekt autoCorrect: $autoFixEnabled") } @@ -65,3 +65,11 @@ tasks.withType { "**/protobuf/**", ) } + +configurations.matching { it.name == "detekt" }.all { + resolutionStrategy.eachDependency { + if (requested.group == "org.jetbrains.kotlin") { + useVersion("1.9.23") + } + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ee69c000200..a5f0a49a106 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -43,7 +43,7 @@ core-crypto-multiplatform = "0.6.0-rc.3-multiplatform-pre1" completeKotlin = "1.1.0" desugar-jdk = "2.0.4" kermit = "2.0.3" -detekt = "main-SNAPSHOT" +detekt = "1.23.6" agp = "8.3.2" dokka = "1.8.20" carthage = "0.0.1" diff --git a/logic/src/androidMain/kotlin/com/wire/kalium/logic/feature/UserSessionScopeProviderImpl.kt b/logic/src/androidMain/kotlin/com/wire/kalium/logic/feature/UserSessionScopeProviderImpl.kt index 61b9782880e..c2d3fb40717 100644 --- a/logic/src/androidMain/kotlin/com/wire/kalium/logic/feature/UserSessionScopeProviderImpl.kt +++ b/logic/src/androidMain/kotlin/com/wire/kalium/logic/feature/UserSessionScopeProviderImpl.kt @@ -53,7 +53,7 @@ internal actual class UserSessionScopeProviderImpl( private val networkStateObserver: NetworkStateObserver, private val logoutCallback: LogoutCallback, userAgent: String -) : UserSessionScopeProviderCommon(globalCallManager, userStorageProvider, userAgent) { +) : UserSessionScopeProviderCommon(globalCallManager, userStorageProvider, userAgent), UserSessionScopeProvider { override fun create(userId: UserId): UserSessionScope { val userIdEntity = userId.toDao() diff --git a/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/UserSessionScopeProvider.kt b/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/UserSessionScopeProvider.kt index e034fce003a..7f1d9db6e8c 100644 --- a/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/UserSessionScopeProvider.kt +++ b/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/UserSessionScopeProvider.kt @@ -58,4 +58,4 @@ abstract class UserSessionScopeProviderCommon( abstract fun create(userId: UserId): UserSessionScope } -internal expect class UserSessionScopeProviderImpl : UserSessionScopeProviderCommon +internal expect class UserSessionScopeProviderImpl : UserSessionScopeProvider diff --git a/util/src/androidMain/kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt b/util/src/androidMain/kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt index c3da5b4ed95..1fa7b5432cf 100644 --- a/util/src/androidMain/kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt +++ b/util/src/androidMain/kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt @@ -20,12 +20,11 @@ package com.wire.kalium.util import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.MainCoroutineDispatcher actual object KaliumDispatcherImpl : KaliumDispatcher { override val default: CoroutineDispatcher get() = Dispatchers.Default - override val main: MainCoroutineDispatcher + override val main: CoroutineDispatcher get() = Dispatchers.Main override val unconfined: CoroutineDispatcher get() = Dispatchers.Unconfined From b83949961a1f700835344991dfac8507474d3fe5 Mon Sep 17 00:00:00 2001 From: Vitor Hugo Schwaab Date: Wed, 17 Jul 2024 22:14:06 +0200 Subject: [PATCH 3/6] chore: return supertype in `actual` class --- .../kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt | 3 +-- .../jsMain/kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt | 3 +-- .../kotlin/com/wire/kalium/util/KaliumDispatcherImpl.kt | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/util/src/appleMain/kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt b/util/src/appleMain/kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt index cce8e5fba57..2a78940a81c 100644 --- a/util/src/appleMain/kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt +++ b/util/src/appleMain/kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt @@ -20,12 +20,11 @@ package com.wire.kalium.util import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.MainCoroutineDispatcher actual object KaliumDispatcherImpl : KaliumDispatcher { override val default: CoroutineDispatcher get() = Dispatchers.Default - override val main: MainCoroutineDispatcher + override val main: CoroutineDispatcher get() = Dispatchers.Main override val unconfined: CoroutineDispatcher get() = Dispatchers.Unconfined diff --git a/util/src/jsMain/kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt b/util/src/jsMain/kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt index cce8e5fba57..2a78940a81c 100644 --- a/util/src/jsMain/kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt +++ b/util/src/jsMain/kotlin/com.wire.kalium.util/KaliumDispatcherImpl.kt @@ -20,12 +20,11 @@ package com.wire.kalium.util import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.MainCoroutineDispatcher actual object KaliumDispatcherImpl : KaliumDispatcher { override val default: CoroutineDispatcher get() = Dispatchers.Default - override val main: MainCoroutineDispatcher + override val main: CoroutineDispatcher get() = Dispatchers.Main override val unconfined: CoroutineDispatcher get() = Dispatchers.Unconfined diff --git a/util/src/jvmMain/kotlin/com/wire/kalium/util/KaliumDispatcherImpl.kt b/util/src/jvmMain/kotlin/com/wire/kalium/util/KaliumDispatcherImpl.kt index c3da5b4ed95..1fa7b5432cf 100644 --- a/util/src/jvmMain/kotlin/com/wire/kalium/util/KaliumDispatcherImpl.kt +++ b/util/src/jvmMain/kotlin/com/wire/kalium/util/KaliumDispatcherImpl.kt @@ -20,12 +20,11 @@ package com.wire.kalium.util import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.MainCoroutineDispatcher actual object KaliumDispatcherImpl : KaliumDispatcher { override val default: CoroutineDispatcher get() = Dispatchers.Default - override val main: MainCoroutineDispatcher + override val main: CoroutineDispatcher get() = Dispatchers.Main override val unconfined: CoroutineDispatcher get() = Dispatchers.Unconfined From bf1ca065702a75bc3c326f24a13d932fce43db9c Mon Sep 17 00:00:00 2001 From: Jakub Zerko Date: Thu, 12 Sep 2024 10:36:37 +0200 Subject: [PATCH 4/6] fix: detekt upgrade --- buildSrc/src/main/kotlin/scripts/detekt.gradle.kts | 14 +++++++------- gradle/libs.versions.toml | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/buildSrc/src/main/kotlin/scripts/detekt.gradle.kts b/buildSrc/src/main/kotlin/scripts/detekt.gradle.kts index 00b1858d516..f68130dc4c1 100644 --- a/buildSrc/src/main/kotlin/scripts/detekt.gradle.kts +++ b/buildSrc/src/main/kotlin/scripts/detekt.gradle.kts @@ -66,10 +66,10 @@ tasks.withType { ) } -configurations.matching { it.name == "detekt" }.all { - resolutionStrategy.eachDependency { - if (requested.group == "org.jetbrains.kotlin") { - useVersion("1.9.23") - } - } -} +// configurations.matching { it.name == "detekt" }.all { +// resolutionStrategy.eachDependency { +// if (requested.group == "org.jetbrains.kotlin") { +// useVersion("1.9.23") +// } +// } +// } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ce87555a93b..f0b00901d7f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "2.0.0" +kotlin = "2.0.10" activity-compose = "1.9.0" app-compat = "1.6.1" android-paging3 = "3.2.1" @@ -43,8 +43,8 @@ core-crypto-multiplatform = "0.6.0-rc.3-multiplatform-pre1" completeKotlin = "1.1.0" desugar-jdk = "2.0.4" kermit = "2.0.3" -detekt = "1.23.6" -agp = "8.3.2" +detekt = "1.23.7" +agp = "8.5.2" dokka = "1.8.20" carthage = "0.0.1" libsodiumBindings = "0.8.7" @@ -80,7 +80,7 @@ kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } -ksp = { id = "com.google.devtools.ksp", version = "2.0.0-1.0.22" } +ksp = { id = "com.google.devtools.ksp", version = "2.0.10-1.0.24" } carthage = { id = "com.wire.carthage-gradle-plugin", version.ref = "carthage" } sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" } protobuf = { id = "com.google.protobuf", version.ref = "protobufCodegen" } From 25a21f2741339103fe91efdad30dcf683b9bf243 Mon Sep 17 00:00:00 2001 From: Jakub Zerko Date: Fri, 8 Nov 2024 10:19:11 +0100 Subject: [PATCH 5/6] fix --- android/build.gradle.kts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/android/build.gradle.kts b/android/build.gradle.kts index f2ef85c4e43..38029663f07 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -41,10 +41,6 @@ android { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() - } - buildTypes { debug {} release {} From 921e07b7a55590de6ca1a4127ad69e1762dc04e3 Mon Sep 17 00:00:00 2001 From: Jakub Zerko Date: Fri, 8 Nov 2024 10:56:10 +0100 Subject: [PATCH 6/6] chore: kotlin and ksp update --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 16cdb679262..d6457db06e9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -kotlin = "2.0.10" -ksp = "1.9.23-1.0.20" +kotlin = "2.0.21" +ksp = "2.0.21-1.0.25" activity-compose = "1.9.0" app-compat = "1.6.1" android-paging3 = "3.2.1"