diff --git a/.gitignore b/.gitignore index 13f1a599..59816437 100644 --- a/.gitignore +++ b/.gitignore @@ -160,3 +160,6 @@ fabric.properties # Default output directory for APK and Bundle collection tasks app/outputs + +# K2 generated directory +.kotlin/ diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 872c1eae..b6f0a378 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -13,6 +13,7 @@ plugins { id("com.github.android-password-store.sentry") id("com.github.android-password-store.rename-artifacts") alias(libs.plugins.hilt) + alias(libs.plugins.kotlin.composeCompiler) } crowdin { @@ -30,10 +31,7 @@ android { } buildFeatures { compose = true } - composeOptions { - useLiveLiterals = false - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } + composeOptions { useLiveLiterals = false } packaging { resources.excludes.add("META-INF/versions/**") } } diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt index 221aefef..46a5eb30 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt @@ -6,15 +6,12 @@ package app.passwordstore.gradle import app.passwordstore.gradle.KotlinCommonPlugin.Companion.JVM_TOOLCHAIN_ACTION -import org.gradle.accessors.dm.LibrariesForLibs import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.getByType -import org.gradle.kotlin.dsl.withType import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension import org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPluginWrapper -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @Suppress("Unused") class KotlinAndroidPlugin : Plugin { @@ -25,30 +22,5 @@ class KotlinAndroidPlugin : Plugin { apply(KotlinCommonPlugin::class) } project.extensions.getByType().jvmToolchain(JVM_TOOLCHAIN_ACTION) - val libs = project.extensions.getByName("libs") as LibrariesForLibs - val composeCompilerVersion = libs.versions.composeCompiler.get() - val kotlinVersion = libs.versions.kotlin.get() - val matches = COMPOSE_COMPILER_VERSION_REGEX.find(composeCompilerVersion) - - project.tasks.withType().configureEach { - compilerOptions.freeCompilerArgs.addAll( - "-P", - "plugin:androidx.compose.compiler.plugins.kotlin:featureFlag=StrongSkipping", - ) - if (matches != null) { - val (compilerKotlinVersion) = matches.destructured - if (compilerKotlinVersion != kotlinVersion) { - compilerOptions.freeCompilerArgs.addAll( - "-P", - "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=$kotlinVersion", - ) - } - } - } - } - - private companion object { - // Matches against 1.5.0-dev-k1.9.0-6a60475e07f - val COMPOSE_COMPILER_VERSION_REGEX = "\\d.\\d.\\d-dev-k(\\d.\\d.\\d+)-[a-z0-9]+".toRegex() } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f191fe8f..28654e3f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,12 +2,10 @@ agp = "8.4.1" androidxActivity = "1.9.0" bouncycastle = "1.78.1" -# @keep used for kotlinCompilerExtensionVersion -composeCompiler = "1.5.14-dev-k1.9.24-50022def4af" coroutines = "1.8.1" flowbinding = "1.2.0" hilt = "2.51.1" -kotlin = "1.9.24" +kotlin = "2.0.0" kotlinResult = "2.0.0" lifecycle = "2.8.0" moshi = "1.15.1" @@ -109,3 +107,4 @@ testDependencies = [ [plugins] hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } +kotlin-composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } diff --git a/ui/compose/build.gradle.kts b/ui/compose/build.gradle.kts index 21f1e469..4996bb10 100644 --- a/ui/compose/build.gradle.kts +++ b/ui/compose/build.gradle.kts @@ -5,6 +5,7 @@ plugins { id("com.github.android-password-store.android-library") id("com.github.android-password-store.kotlin-android") + alias(libs.plugins.kotlin.composeCompiler) } android { @@ -12,10 +13,7 @@ android { compose = true androidResources = true } - composeOptions { - useLiveLiterals = false - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } + composeOptions { useLiveLiterals = false } namespace = "app.passwordstore.ui.compose" }