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 67179436..a39af98d 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 d8960a87..956be5ae 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) @@ -19,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") } @@ -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.properties b/gradle.properties index b2273c21..aa052e08 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 429183be..7f26cd92 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` +agp = "8.13.1" +kotlin = "2.2.20" +ksp = "2.3.0" 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.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.4.0" # Must be compatible with: `ksp` -ktor = "3.1.0" # 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.4" -skie = "0.10.2" # Must be compatible with: `kotlin` +kermit = "2.0.8" +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.24.5" +moko-resources = "0.25.2" baselineProfile = "1.3.4" junit = "1.2.1" espressoCore = "3.6.1" diff --git a/shared/app/build.gradle.kts b/shared/app/build.gradle.kts index 1021f87e..d3588ff5 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 8c87899e..08c7b491 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 b4528286..4ee373f5 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 7edbbef5..34de17c8 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 {