aboutsummaryrefslogtreecommitdiff
path: root/build-logic/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'build-logic/src/main')
-rw-r--r--build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt19
1 files changed, 19 insertions, 0 deletions
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 46a5eb30..9e1641f3 100644
--- a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt
+++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinAndroidPlugin.kt
@@ -8,10 +8,15 @@ package app.passwordstore.gradle
import app.passwordstore.gradle.KotlinCommonPlugin.Companion.JVM_TOOLCHAIN_ACTION
import org.gradle.api.Plugin
import org.gradle.api.Project
+import org.gradle.api.artifacts.VersionCatalog
+import org.gradle.api.artifacts.VersionCatalogsExtension
+import org.gradle.api.artifacts.VersionConstraint
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<Project> {
@@ -22,5 +27,19 @@ class KotlinAndroidPlugin : Plugin<Project> {
apply(KotlinCommonPlugin::class)
}
project.extensions.getByType<KotlinProjectExtension>().jvmToolchain(JVM_TOOLCHAIN_ACTION)
+ val catalog = project.extensions.getByType<VersionCatalogsExtension>()
+ val libs = catalog.named("libs")
+ if (libs.getVersion("composeCompiler").contains("-dev")) {
+ val kotlinVersion = libs.getVersion("kotlin")
+ project.tasks.withType<KotlinCompile>().configureEach {
+ compilerOptions.freeCompilerArgs.addAll(
+ "-P",
+ "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=$kotlinVersion",
+ )
+ }
+ }
}
+
+ private fun VersionCatalog.getVersion(key: String) =
+ findVersion(key).map(VersionConstraint::toString).get()
}