From 4a298c21933c2c8ab08bd207c687f6df8df3cb4a Mon Sep 17 00:00:00 2001 From: matejsemancik Date: Sat, 1 Nov 2025 22:31:28 +0100 Subject: [PATCH 1/5] Update dependencies and Kotlin version --- gradle.properties | 3 ++- gradle/libs.versions.toml | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index b2273c2..35dbf51 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,6 @@ #Gradle -org.gradle.jvmargs=-Xmx6g -Xms256m -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dkotlin.daemon.jvm.options=-XX:MaxMetaspaceSize=1g +org.gradle.jvmargs=-Xmx6g -Xms256m -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError" +kotlin.daemon.jvm.options=-XX:MaxMetaspaceSize=1g org.gradle.parallel=true org.gradle.caching=true org.gradle.configureondemand=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 429183b..4e01374 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] agp = "8.11.1" -kotlin = "2.1.20" -ksp = "2.1.20-1.0.32" # Must be compatible with: `kotlin` +kotlin = "2.2.10" +ksp = "2.2.10-2.0.2" # Must be compatible with: `kotlin` desugarLibs = "2.1.5" androidxLifecycle = "2.9.1" androidxComposeBom = "2025.06.01" @@ -10,7 +10,7 @@ androidxActivity = "1.10.1" decompose = "3.3.0" essenty = "2.5.0" koin = "4.1.0" -koinAnnotations = "2.1.0" # Must be compatible with: `ksp` +koinAnnotations = "2.3.0" # Must be compatible with: `ksp` kotlinx-coroutines = "1.10.2" kotlinx-immutableCollections = "0.4.0" kotlinx-dateTime = "0.6.2" @@ -19,16 +19,16 @@ ktlint = "1.6.0" detektGradlePlugin = "1.23.8" composeLint = "1.4.2" apollo = "4.3.1" -ktorfit = "2.4.0" # Must be compatible with: `ksp` -ktor = "3.1.0" # Must be compatible with: `ktorfit` +ktorfit = "2.6.4" # Must be compatible with: `ksp` +ktor = "3.3.1" # Must be compatible with: `ktorfit` kotlinx-serialization = "1.8.0" # Must be compatible with: `kotlin` timber = "5.0.1" -kermit = "2.0.4" -skie = "0.10.2" # Must be compatible with: `kotlin` +kermit = "2.0.8" +skie = "0.10.6" # Must be compatible with: `kotlin` buildkonfig = "0.17.1" nsExceptionKt = "1.0.0-BETA-7" datastore = "1.1.1" -moko-resources = "0.24.5" +moko-resources = "0.25.0" baselineProfile = "1.3.4" junit = "1.2.1" espressoCore = "3.6.1" From 6aa3525b9a8cb5cc0f702101e41fe37cb3f78803 Mon Sep 17 00:00:00 2001 From: matejsemancik Date: Sun, 2 Nov 2025 17:09:03 +0100 Subject: [PATCH 2/5] Fix: KSP build variant support This commit adds support for build variant-aware KSP (Kotlin Symbol Processing) tasks. Key changes: - Adds a mechanism to the `conventions-annotations-processor` to correctly wire KSP task dependencies for different Android build types (e.g., debug, release). - Updates all relevant `build.gradle.kts` files to pass the build types to the convention plugin. - Bumps the `ksp` version to `2.3.0`. --- .../gradle/configuration/ProjectSettings.kt | 2 ++ ...nventions-annotations-processor.gradle.kts | 22 +++++++++++++++++++ gradle/libs.versions.toml | 2 +- shared/app/build.gradle.kts | 1 + shared/feature/build.gradle.kts | 1 + shared/network/graphql/build.gradle.kts | 1 + shared/persistence/build.gradle.kts | 1 + 7 files changed, 29 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/app/futured/kmptemplate/gradle/configuration/ProjectSettings.kt b/buildSrc/src/main/kotlin/app/futured/kmptemplate/gradle/configuration/ProjectSettings.kt index 6717943..a39af98 100644 --- a/buildSrc/src/main/kotlin/app/futured/kmptemplate/gradle/configuration/ProjectSettings.kt +++ b/buildSrc/src/main/kotlin/app/futured/kmptemplate/gradle/configuration/ProjectSettings.kt @@ -26,6 +26,8 @@ object ProjectSettings { const val Debug = "debug" const val Enterprise = "enterprise" const val Release = "release" + + val all = listOf(Debug, Enterprise, Release) } object Signing { diff --git a/convention-plugins/src/main/kotlin/conventions-annotations-processor.gradle.kts b/convention-plugins/src/main/kotlin/conventions-annotations-processor.gradle.kts index d8960a8..6ae77e7 100644 --- a/convention-plugins/src/main/kotlin/conventions-annotations-processor.gradle.kts +++ b/convention-plugins/src/main/kotlin/conventions-annotations-processor.gradle.kts @@ -1,4 +1,5 @@ import org.gradle.accessors.dm.LibrariesForLibs +import org.gradle.kotlin.dsl.support.uppercaseFirstChar import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask // As of now, we cannot use Gradle version catalogs with Precompiled Script plugins: https://github.com/gradle/gradle/issues/15383 @@ -8,8 +9,21 @@ plugins { // Allow configuring which processor to use (or both) abstract class AnnotationsExtension { + + /** + * Configures Koin annotations if enabled. + */ var useKoin: Boolean = false + + /** + * Configures Component factory generation if enabled + */ var useComponentFactory: Boolean = false + + /** + * Configures Android build variant KSP task dependencies for each build variant provided + */ + var androidBuildTypes: List = emptyList() } val extension = extensions.create("annotations", AnnotationsExtension::class) @@ -58,3 +72,11 @@ tasks.withType>().configureEach { } } } + +// Manual wiring of task dependencies needed for build variant-dependent KSP tasks +tasks.named { taskName -> + val taskNames = extension.androidBuildTypes.map { "ksp${it.uppercaseFirstChar()}KotlinAndroid" } + taskName in taskNames +}.configureEach { + mustRunAfter("kspCommonMainKotlinMetadata") +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4e01374..9692197 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] agp = "8.11.1" kotlin = "2.2.10" -ksp = "2.2.10-2.0.2" # Must be compatible with: `kotlin` +ksp = "2.3.0" # Must be compatible with: `kotlin` desugarLibs = "2.1.5" androidxLifecycle = "2.9.1" androidxComposeBom = "2025.06.01" diff --git a/shared/app/build.gradle.kts b/shared/app/build.gradle.kts index 1021f87..d3588ff 100644 --- a/shared/app/build.gradle.kts +++ b/shared/app/build.gradle.kts @@ -22,6 +22,7 @@ plugins { annotations { useKoin = true + androidBuildTypes = ProjectSettings.Android.BuildTypes.all } kotlin { diff --git a/shared/feature/build.gradle.kts b/shared/feature/build.gradle.kts index 8c87899..08c7b49 100644 --- a/shared/feature/build.gradle.kts +++ b/shared/feature/build.gradle.kts @@ -14,6 +14,7 @@ plugins { annotations { useKoin = true useComponentFactory = true + androidBuildTypes = ProjectSettings.Android.BuildTypes.all } dependencies { diff --git a/shared/network/graphql/build.gradle.kts b/shared/network/graphql/build.gradle.kts index b452828..4ee373f 100644 --- a/shared/network/graphql/build.gradle.kts +++ b/shared/network/graphql/build.gradle.kts @@ -15,6 +15,7 @@ plugins { annotations { useKoin = true + androidBuildTypes = ProjectSettings.Android.BuildTypes.all } kotlin { diff --git a/shared/persistence/build.gradle.kts b/shared/persistence/build.gradle.kts index 7edbbef..34de17c 100644 --- a/shared/persistence/build.gradle.kts +++ b/shared/persistence/build.gradle.kts @@ -12,6 +12,7 @@ plugins { annotations { useKoin = true + androidBuildTypes = ProjectSettings.Android.BuildTypes.all } kotlin { From b39cd3dfe0384a7b8b04b37c041c9f82be2889c3 Mon Sep 17 00:00:00 2001 From: matejsemancik Date: Sun, 2 Nov 2025 17:09:12 +0100 Subject: [PATCH 3/5] Disable Koin config check at compile time --- .../main/kotlin/conventions-annotations-processor.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/convention-plugins/src/main/kotlin/conventions-annotations-processor.gradle.kts b/convention-plugins/src/main/kotlin/conventions-annotations-processor.gradle.kts index 6ae77e7..956be5a 100644 --- a/convention-plugins/src/main/kotlin/conventions-annotations-processor.gradle.kts +++ b/convention-plugins/src/main/kotlin/conventions-annotations-processor.gradle.kts @@ -33,7 +33,7 @@ afterEvaluate { if (extension.useKoin) { ksp { // enable compile time check - arg("KOIN_CONFIG_CHECK", "true") + arg("KOIN_CONFIG_CHECK", "false") // disable default module generation arg("KOIN_DEFAULT_MODULE", "false") } From ee2d73a134fe511dcf7e9e8a1c37243eba6725f3 Mon Sep 17 00:00:00 2001 From: matejsemancik Date: Sun, 2 Nov 2025 17:17:08 +0100 Subject: [PATCH 4/5] Chore: Remove outdated KSP version comment --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9692197..85e13d9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] agp = "8.11.1" kotlin = "2.2.10" -ksp = "2.3.0" # Must be compatible with: `kotlin` +ksp = "2.3.0" desugarLibs = "2.1.5" androidxLifecycle = "2.9.1" androidxComposeBom = "2025.06.01" From 952470d04a8e1b6bf800ed9bfcfe9b7f4daecc13 Mon Sep 17 00:00:00 2001 From: "jan.mikulik" Date: Mon, 8 Dec 2025 10:50:45 +0100 Subject: [PATCH 5/5] Update to 2.2.20 --- gradle.properties | 2 +- gradle/libs.versions.toml | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 35dbf51..aa052e0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ #Gradle -org.gradle.jvmargs=-Xmx6g -Xms256m -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError" +org.gradle.jvmargs=-Xmx6g -Xms256m -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError kotlin.daemon.jvm.options=-XX:MaxMetaspaceSize=1g org.gradle.parallel=true org.gradle.caching=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 85e13d9..7f26cd9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -agp = "8.11.1" -kotlin = "2.2.10" +agp = "8.13.1" +kotlin = "2.2.20" ksp = "2.3.0" desugarLibs = "2.1.5" androidxLifecycle = "2.9.1" @@ -10,7 +10,7 @@ androidxActivity = "1.10.1" decompose = "3.3.0" essenty = "2.5.0" koin = "4.1.0" -koinAnnotations = "2.3.0" # Must be compatible with: `ksp` +koinAnnotations = "2.3.1" # Must be compatible with: `ksp` kotlinx-coroutines = "1.10.2" kotlinx-immutableCollections = "0.4.0" kotlinx-dateTime = "0.6.2" @@ -19,16 +19,16 @@ ktlint = "1.6.0" detektGradlePlugin = "1.23.8" composeLint = "1.4.2" apollo = "4.3.1" -ktorfit = "2.6.4" # Must be compatible with: `ksp` -ktor = "3.3.1" # Must be compatible with: `ktorfit` +ktorfit = "2.6.5" # Must be compatible with: `ksp` +ktor = "3.3.3" # Must be compatible with: `ktorfit` kotlinx-serialization = "1.8.0" # Must be compatible with: `kotlin` timber = "5.0.1" kermit = "2.0.8" -skie = "0.10.6" # Must be compatible with: `kotlin` +skie = "0.10.8" # Must be compatible with: `kotlin` buildkonfig = "0.17.1" nsExceptionKt = "1.0.0-BETA-7" datastore = "1.1.1" -moko-resources = "0.25.0" +moko-resources = "0.25.2" baselineProfile = "1.3.4" junit = "1.2.1" espressoCore = "3.6.1"