From 3e9549c5bf1548c87d92938a4649b1a3f9076855 Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 29 Jul 2026 11:49:52 +0200 Subject: [PATCH 1/5] Stop using deprecated gradle `by getting` api --- app/app/build.gradle.kts | 8 ++++---- app/network/network-clients/build.gradle.kts | 2 +- micro-apps/design-showcase/build.gradle.kts | 5 ++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/app/build.gradle.kts b/app/app/build.gradle.kts index cbd7883afb..7454577637 100644 --- a/app/app/build.gradle.kts +++ b/app/app/build.gradle.kts @@ -43,14 +43,14 @@ android { } buildTypes { - val debug by getting { + getByName("debug") { applicationIdSuffix = ".dev.app" manifestPlaceholders["firebaseCrashlyticsCollectionEnabled"] = false isDebuggable = true } - val release by getting { -// signingConfig = debug.signingConfig // uncomment to run release build locally + getByName("release") { +// signingConfig = getByName("debug").signingConfig // uncomment to run release build locally applicationIdSuffix = ".app" manifestPlaceholders["firebaseCrashlyticsCollectionEnabled"] = true @@ -64,7 +64,7 @@ android { ) } - val staging by creating { + create("staging") { applicationIdSuffix = ".app" manifestPlaceholders["firebaseCrashlyticsCollectionEnabled"] = true isMinifyEnabled = true diff --git a/app/network/network-clients/build.gradle.kts b/app/network/network-clients/build.gradle.kts index 6585c6e761..1f177148d1 100644 --- a/app/network/network-clients/build.gradle.kts +++ b/app/network/network-clients/build.gradle.kts @@ -35,7 +35,7 @@ kotlin { implementation(projects.coreDatastorePublic) implementation(projects.languageCore) } - val mobileMain by getting { + getByName("mobileMain") { dependencies { implementation(libs.datadog.sdk.ktor) } diff --git a/micro-apps/design-showcase/build.gradle.kts b/micro-apps/design-showcase/build.gradle.kts index c335c6a51d..c6fbdf5ae2 100644 --- a/micro-apps/design-showcase/build.gradle.kts +++ b/micro-apps/design-showcase/build.gradle.kts @@ -28,11 +28,10 @@ android { } buildTypes { - @Suppress("UNUSED_VARIABLE") - val debug by getting { + val debug = getByName("debug") { isDebuggable = true } - val release by getting { + getByName("release") { signingConfig = debug.signingConfig applicationIdSuffix = ".app" isMinifyEnabled = true From b680930aa8c1e334fdf02ae15c7feb8457bd8c9d Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 29 Jul 2026 13:28:52 +0200 Subject: [PATCH 2/5] Stop using deprecated Project-as-dependency-notation in convention plugin Replace project.project(":path") with the Kotlin DSL DependencyHandler.project(String) at the Apollo, navKeys, and viewModels wiring sites. Passing a Project object as a dependency notation is deprecated in Gradle 9 and fails in Gradle 10. --- .../com/hedvig/android/HedvigGradlePluginExtension.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build-logic/convention/src/main/kotlin/com/hedvig/android/HedvigGradlePluginExtension.kt b/build-logic/convention/src/main/kotlin/com/hedvig/android/HedvigGradlePluginExtension.kt index ef48d66d91..c6710ca2e1 100644 --- a/build-logic/convention/src/main/kotlin/com/hedvig/android/HedvigGradlePluginExtension.kt +++ b/build-logic/convention/src/main/kotlin/com/hedvig/android/HedvigGradlePluginExtension.kt @@ -22,6 +22,7 @@ import org.gradle.kotlin.dsl.create import org.gradle.kotlin.dsl.dependencies import org.gradle.kotlin.dsl.findByType import org.gradle.kotlin.dsl.newInstance +import org.gradle.kotlin.dsl.project import org.gradle.kotlin.dsl.the import org.gradle.kotlin.dsl.withType import org.jetbrains.compose.ComposeExtension @@ -194,7 +195,7 @@ private abstract class ApolloHandler { this.packageName.set(packageName) @Suppress("OPT_IN_USAGE") - dependsOn(project.project(":apollo-octopus-public"), true) + dependsOn(project.dependencies.project(":apollo-octopus-public"), true) extraConfiguration.execute(this) } } @@ -320,7 +321,7 @@ private abstract class NavKeysHandler { val isMultiplatform = project.extensions.findByType() != null val kspConfiguration = if (isMultiplatform) "kspAndroid" else "ksp" project.dependencies { - add(kspConfiguration, project.project(":navigation-keys-processor")) + add(kspConfiguration, project(":navigation-keys-processor")) } } } @@ -328,7 +329,7 @@ private abstract class NavKeysHandler { private abstract class ViewModelsHandler { fun configure(project: Project, pluginManager: PluginManager, libs: LibrariesForLibs) { pluginManager.apply(libs.plugins.ksp.get().pluginId) - val processor = project.project(":viewmodel-processor") + val processor = project.dependencies.project(":viewmodel-processor") val isMultiplatform = project.extensions.findByType() != null if (!isMultiplatform) { project.dependencies { From 0207ac746c1320a7322b38ae570e2ad2ef9fa1fb Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 29 Jul 2026 13:36:37 +0200 Subject: [PATCH 3/5] Remove dead kotlin.native.cacheKind.iosSimulatorArm64 property The property was removed in Kotlin 2.3.20 and is now a no-op that only emits a deprecation warning. Disabling the native cache now requires the new DSL. --- gradle.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 7ebea3bfd7..6ea663972a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -48,5 +48,4 @@ android.r8.optimizedResourceShrinking=false android.builtInKotlin=false android.newDsl=false -kotlin.native.cacheKind.iosSimulatorArm64=none kotlin.native.binary.forceNativeThreadStateForFunctions=org_jetbrains_skia_DirectContext__1nFlushAndSubmit;org_jetbrains_skia_Canvas__1nDrawPicture From c69c6921e31f3b3276ce95f9f32323dece6ed34b Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 29 Jul 2026 13:36:37 +0200 Subject: [PATCH 4/5] Use stabilized -jvm-default compiler flag -Xjvm-default is deprecated in favor of the stabilized -jvm-default. -Xjvm-default=all maps to -jvm-default=no-compatibility (same codegen: default impls in interfaces, no DefaultImpls/bridges). --- .../app/navigation/ExhaustiveBackStackSerializationTest.kt | 2 +- .../com/hedvig/android/ConfigureKotlinCommonCompilerOptions.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/app/src/test/kotlin/com/hedvig/android/app/navigation/ExhaustiveBackStackSerializationTest.kt b/app/app/src/test/kotlin/com/hedvig/android/app/navigation/ExhaustiveBackStackSerializationTest.kt index 90f9766a88..eab29dc6c7 100644 --- a/app/app/src/test/kotlin/com/hedvig/android/app/navigation/ExhaustiveBackStackSerializationTest.kt +++ b/app/app/src/test/kotlin/com/hedvig/android/app/navigation/ExhaustiveBackStackSerializationTest.kt @@ -121,7 +121,7 @@ internal class ExhaustiveBackstackSerializationTest { private fun invokeDefaultProviderMethod(interfaceClass: Class<*>, provideMethod: Method): SerializersModule { // The providers are Kotlin interfaces whose `provide*` method is a real JVM default method - // (the project compiles with -Xjvm-default). Invoke it via an `invokespecial` MethodHandle so we + // (the project compiles with -jvm-default). Invoke it via an `invokespecial` MethodHandle so we // don't depend on java.lang.reflect.InvocationHandler.invokeDefault, which the `:app` unit-test // classpath resolves against Android's stubbed reflection types that lack it. val proxy = Proxy.newProxyInstance( diff --git a/build-logic/convention/src/main/kotlin/com/hedvig/android/ConfigureKotlinCommonCompilerOptions.kt b/build-logic/convention/src/main/kotlin/com/hedvig/android/ConfigureKotlinCommonCompilerOptions.kt index 1caf1a1cb5..7263b766ad 100644 --- a/build-logic/convention/src/main/kotlin/com/hedvig/android/ConfigureKotlinCommonCompilerOptions.kt +++ b/build-logic/convention/src/main/kotlin/com/hedvig/android/ConfigureKotlinCommonCompilerOptions.kt @@ -8,7 +8,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion internal fun KotlinCommonCompilerOptions.configureKotlinCompilerOptions() { when (this) { is KotlinJvmCompilerOptions -> { - configureCommonKotlinCompilerOptions(listOf("-Xjvm-default=all")) + configureCommonKotlinCompilerOptions(listOf("-jvm-default=no-compatibility")) jvmTarget.set(JvmTarget.JVM_21) } From 6e2735ae4cf65c465ba1f259d4fcf8b456aa09a2 Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 29 Jul 2026 13:57:58 +0200 Subject: [PATCH 5/5] Migrate Android modules to AGP built-in Kotlin AGP 9 provides Kotlin compilation itself, so stop applying org.jetbrains.kotlin.android in the application and library convention plugins and drop the AGP 9 transitional opt-out flags from gradle.properties (android.builtInKotlin, android.newDsl, android.enableAppCompileTimeRClass, android.uniquePackageNames), letting the AGP 9 defaults apply. Because the standalone Kotlin plugin no longer applies to Android modules, the two places that keyed off it in HedvigGradlePlugin now trigger on the AGP plugins instead: Metro application and the shared implementation dependencies (Compose BOM, logging, tracking). Without this the Compose BOM never reached Android modules and their versionless Compose dependencies failed to resolve. --- .../main/kotlin/ApplicationConventionPlugin.kt | 1 - .../src/main/kotlin/HedvigGradlePlugin.kt | 16 ++++++++++++++-- .../src/main/kotlin/LibraryConventionPlugin.kt | 1 - build.gradle.kts | 1 - gradle.properties | 4 ---- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/build-logic/convention/src/main/kotlin/ApplicationConventionPlugin.kt b/build-logic/convention/src/main/kotlin/ApplicationConventionPlugin.kt index 0432888a41..406585454d 100644 --- a/build-logic/convention/src/main/kotlin/ApplicationConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/ApplicationConventionPlugin.kt @@ -15,7 +15,6 @@ class ApplicationConventionPlugin : Plugin { with(pluginManager) { apply(libs.plugins.androidApplication.get().pluginId) apply(libs.plugins.cacheFix.get().pluginId) - apply(libs.plugins.kotlin.get().pluginId) } extensions.configure { diff --git a/build-logic/convention/src/main/kotlin/HedvigGradlePlugin.kt b/build-logic/convention/src/main/kotlin/HedvigGradlePlugin.kt index 4968eedaf4..d5e62a119d 100644 --- a/build-logic/convention/src/main/kotlin/HedvigGradlePlugin.kt +++ b/build-logic/convention/src/main/kotlin/HedvigGradlePlugin.kt @@ -128,7 +128,12 @@ private fun Project.configureMetro(libs: LibrariesForLibs) { pluginManager.withPlugin(libs.plugins.kotlinJvm.get().pluginId) { pluginManager.apply(metroPluginId) } - pluginManager.withPlugin(libs.plugins.kotlin.get().pluginId) { + // Android modules get their Kotlin compilation from AGP's built-in Kotlin support, so key off the + // AGP plugins rather than a standalone Kotlin plugin. + pluginManager.withPlugin(libs.plugins.androidApplication.get().pluginId) { + pluginManager.apply(metroPluginId) + } + pluginManager.withPlugin(libs.plugins.androidLibrary.get().pluginId) { pluginManager.apply(metroPluginId) } @@ -161,7 +166,14 @@ private fun Project.configureCommonDependencies(libs: LibrariesForLibs) { configureCommonDependencies(project, libs) } } - pluginManager.withPlugin(libs.plugins.kotlin.get().pluginId) { + // Android modules use AGP's built-in Kotlin support, so key off the AGP plugins to attach the + // shared implementation dependencies (Compose BOM, logging, tracking). + pluginManager.withPlugin(libs.plugins.androidApplication.get().pluginId) { + dependencies { + configureCommonDependencies(project, libs) + } + } + pluginManager.withPlugin(libs.plugins.androidLibrary.get().pluginId) { dependencies { configureCommonDependencies(project, libs) } diff --git a/build-logic/convention/src/main/kotlin/LibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/LibraryConventionPlugin.kt index 8ca5ee2817..52ca50c8f0 100644 --- a/build-logic/convention/src/main/kotlin/LibraryConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/LibraryConventionPlugin.kt @@ -17,7 +17,6 @@ class LibraryConventionPlugin : Plugin { with(pluginManager) { apply(libs.plugins.androidLibrary.get().pluginId) apply(libs.plugins.cacheFix.get().pluginId) - apply(libs.plugins.kotlin.get().pluginId) } extensions.configure { diff --git a/build.gradle.kts b/build.gradle.kts index 4ae2827811..5c3719b04f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,6 @@ plugins { alias(libs.plugins.doctor) alias(libs.plugins.googleServices) apply false alias(libs.plugins.kmpNativeCoroutines) apply false - alias(libs.plugins.kotlin) apply false alias(libs.plugins.kotlinJvm) apply false alias(libs.plugins.kotlinMultiplatform) apply false alias(libs.plugins.kotlinter) apply false diff --git a/gradle.properties b/gradle.properties index 6ea663972a..6e55696718 100644 --- a/gradle.properties +++ b/gradle.properties @@ -38,14 +38,10 @@ kotlin.internal.collectFUSMetrics=false metro.generateContributionProviders=true android.defaults.buildfeatures.resvalues=true android.sdk.defaultTargetSdkToCompileSdkIfUnset=false -android.enableAppCompileTimeRClass=false android.usesSdkInManifest.disallowed=false -android.uniquePackageNames=false android.dependency.useConstraints=true android.dependency.excludeLibraryComponentsFromConstraints=true android.r8.strictFullModeForKeepRules=false android.r8.optimizedResourceShrinking=false -android.builtInKotlin=false -android.newDsl=false kotlin.native.binary.forceNativeThreadStateForFunctions=org_jetbrains_skia_DirectContext__1nFlushAndSubmit;org_jetbrains_skia_Canvas__1nDrawPicture