This repository was archived by the owner on Oct 15, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
build-logic/src/main/kotlin/app/passwordstore/gradle Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -29,17 +29,28 @@ class KotlinAndroidPlugin : Plugin<Project> {
29
29
project.extensions.getByType<KotlinProjectExtension >().jvmToolchain(JVM_TOOLCHAIN_ACTION )
30
30
val catalog = project.extensions.getByType<VersionCatalogsExtension >()
31
31
val libs = catalog.named(" libs" )
32
- if (libs.getVersion(" composeCompiler" ).contains(" -dev" )) {
33
- val kotlinVersion = libs.getVersion(" kotlin" )
34
- project.tasks.withType<KotlinCompile >().configureEach {
35
- compilerOptions.freeCompilerArgs.addAll(
36
- " -P" ,
37
- " plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=$kotlinVersion " ,
38
- )
32
+ val composeCompilerVersion = libs.getVersion(" composeCompiler" )
33
+ val kotlinVersion = libs.getVersion(" kotlin" )
34
+ val matches = COMPOSE_COMPILER_VERSION_REGEX .find(composeCompilerVersion)
35
+
36
+ if (matches != null ) {
37
+ val (compilerKotlinVersion) = matches.destructured
38
+ if (compilerKotlinVersion != kotlinVersion) {
39
+ project.tasks.withType<KotlinCompile >().configureEach {
40
+ compilerOptions.freeCompilerArgs.addAll(
41
+ " -P" ,
42
+ " plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=$kotlinVersion " ,
43
+ )
44
+ }
39
45
}
40
46
}
41
47
}
42
48
43
49
private fun VersionCatalog.getVersion (key : String ) =
44
50
findVersion(key).map(VersionConstraint ::toString).get()
51
+
52
+ private companion object {
53
+ // Matches against 1.5.0-dev-k1.9.0-6a60475e07f
54
+ val COMPOSE_COMPILER_VERSION_REGEX = " \\ d.\\ d.\\ d-dev-k(\\ d.\\ d.\\ d)-[a-z0-9]+" .toRegex()
55
+ }
45
56
}
You can’t perform that action at this time.
0 commit comments