From 48906ae20777c0d3637a288cecd46aa247150967 Mon Sep 17 00:00:00 2001 From: David Perez Date: Wed, 29 May 2024 10:36:35 -0500 Subject: [PATCH] Update to Kotlin 2.0.0 (#1397) --- .github/renovate.json | 1 - .gitignore | 3 +++ app/build.gradle.kts | 14 ++++++++------ build.gradle.kts | 1 + gradle/libs.versions.toml | 10 ++++------ 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index 6f6dc96a6..aa9c41859 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -35,7 +35,6 @@ "groupName": "kotlin", "description": "Kotlin and Compose dependencies that must be updated together to maintain compatibility.", "matchPackagePatterns": [ - "androidx.compose.compiler:compiler", "androidx.compose:compose-bom", "org.jetbrains.kotlin.*", "com.google.devtools.ksp" diff --git a/.gitignore b/.gitignore index 747f4fe18..b0ead9fc2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ fastlane/README.md .DS_Store Thumbs.db +# Kotlin +.kotlin/ + # Gradle build cache /build-cache/ diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d4074f462..f73d1df9f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,6 +1,7 @@ import com.google.firebase.crashlytics.buildtools.gradle.tasks.InjectMappingFileIdTask import com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask import com.google.gms.googleservices.GoogleServicesTask +import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { alias(libs.plugins.android.application) @@ -10,6 +11,7 @@ plugins { alias(libs.plugins.detekt) alias(libs.plugins.hilt) alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.compose.compiler) alias(libs.plugins.kotlin.parcelize) alias(libs.plugins.kotlin.serialization) alias(libs.plugins.kotlinx.kover) @@ -90,16 +92,10 @@ android { sourceCompatibility(libs.versions.jvmTarget.get()) targetCompatibility(libs.versions.jvmTarget.get()) } - kotlinOptions { - jvmTarget = libs.versions.jvmTarget.get() - } buildFeatures { buildConfig = true compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.kotlinCompilerExtensionVersion.get() - } packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" @@ -113,6 +109,12 @@ android { } } +kotlin { + compilerOptions { + jvmTarget.set(JvmTarget.fromTarget(libs.versions.jvmTarget.get())) + } +} + dependencies { fun standardImplementation(dependencyNotation: Any) { add("standardImplementation", dependencyNotation) diff --git a/build.gradle.kts b/build.gradle.kts index 9a69204f0..85d304ea3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.android.application) apply false alias(libs.plugins.hilt) apply false alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.compose.compiler) apply false alias(libs.plugins.kotlin.parcelize) apply false alias(libs.plugins.kotlinx.kover) apply false alias(libs.plugins.ksp) apply false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d8fdc3f69..cb1f117a9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -33,16 +33,13 @@ googleServices = "4.4.1" hilt = "2.51.1" junit5 = "5.10.2" jvmTarget = "17" -# kotlin and kotlinCompileExtensions **must** use compatible versions. Do not update either without -# first checking the Compose to Kotlin Compatibility Map. -# https://developer.android.com/jetpack/androidx/releases/compose-kotlin -kotlin = "1.9.24" -kotlinCompilerExtensionVersion = "1.5.14" +# kotlin and ksp **must** use compatible versions, do not update either without the other. +kotlin = "2.0.0" kotlinxCollectionsImmutable = "0.3.7" kotlinxCoroutines = "1.8.1" kotlinxSerialization = "1.6.3" kotlinxKover = "0.8.0" -ksp = "1.9.24-1.0.20" +ksp = "2.0.0-1.0.21" mockk = "1.13.11" okhttp = "4.12.0" retrofitBom = "2.11.0" @@ -120,6 +117,7 @@ detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" } hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kotlinxKover" }