From 6fc8a502b3ca8e226296fffc2a695d5468d8678b Mon Sep 17 00:00:00 2001 From: Patrick Honkonen Date: Fri, 14 Jun 2024 15:01:10 -0400 Subject: [PATCH] Migrate to kotlin compose compiler bom --- .gitignore | 1 + app/build.gradle.kts | 14 ++++++++------ build.gradle.kts | 1 + gradle/libs.versions.toml | 7 +------ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index fca9865e0..81a240a15 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ local.properties # Fastlane fastlane/report.xml fastlane/README.md +/.kotlin/ diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1ec4da9bd..c167fba39 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,10 +1,12 @@ import com.google.protobuf.gradle.proto +import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { alias(libs.plugins.android.application) alias(libs.plugins.crashlytics) 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) @@ -53,16 +55,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,LICENSE*.md}" @@ -77,6 +73,12 @@ android { } } +kotlin { + compilerOptions { + jvmTarget.set(JvmTarget.fromTarget(libs.versions.jvmTarget.get())) + } +} + dependencies { implementation(libs.androidx.activity.compose) diff --git a/build.gradle.kts b/build.gradle.kts index e9f5de418..21d04e7d6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,6 +5,7 @@ plugins { alias(libs.plugins.google.services) 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 7608d0ed3..5d1923bdb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -39,11 +39,7 @@ 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 = "2.0.0" -kotlinCompilerExtensionVersion = "1.5.14" kotlinxCollectionsImmutable = "0.3.7" kotlinxCoroutines = "1.8.1" kotlinxSerialization = "1.6.3" @@ -70,8 +66,6 @@ androidx-camera-lifecycle = { group = "androidx.camera", name = "camera-lifecycl androidx-camera-view = { module = "androidx.camera:camera-view", version.ref = "androidxCamera" } androidx-compose-animation = { module = "androidx.compose.animation:animation" } androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "androidxComposeBom" } -# Included so that Renovate tracks updates since Compose Compiler is not referenced directly in `dependency {}` blocks. -androidx-compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "kotlinCompilerExtensionVersion" } androidx-compose-material3 = { module = "androidx.compose.material3:material3" } androidx-compose-runtime = { module = "androidx.compose.runtime:runtime" } androidx-compose-ui = { module = "androidx.compose.ui:ui" } @@ -132,6 +126,7 @@ google-protobuf = { id = "com.google.protobuf", version.ref = "googleProtoBufPlu 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" }