From 5be13a047b35879e5ed5ddf91487e7664519b324 Mon Sep 17 00:00:00 2001 From: Ben Trengrove Date: Tue, 5 Dec 2023 10:51:29 +1100 Subject: [PATCH] Enable strong skipping --- .../com/google/samples/apps/nowinandroid/AndroidCompose.kt | 7 +++++++ compose_compiler_config.conf | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidCompose.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidCompose.kt index 234313e1f..e38c5b300 100644 --- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidCompose.kt +++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidCompose.kt @@ -57,6 +57,7 @@ internal fun Project.configureAndroidCompose( kotlinOptions { freeCompilerArgs += buildComposeMetricsParameters() freeCompilerArgs += stabilityConfiguration() + freeCompilerArgs += strongSkippingConfiguration() } } } @@ -84,6 +85,7 @@ private fun Project.buildComposeMetricsParameters(): List { "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" + reportsFolder.absolutePath ) } + return metricParameters.toList() } @@ -91,3 +93,8 @@ private fun Project.stabilityConfiguration() = listOf( "-P", "plugin:androidx.compose.compiler.plugins.kotlin:stabilityConfigurationPath=${project.rootDir.absolutePath}/compose_compiler_config.conf", ) + +private fun Project.strongSkippingConfiguration() = listOf( + "-P", + "plugin:androidx.compose.compiler.plugins.kotlin:experimentalStrongSkipping=true", +) diff --git a/compose_compiler_config.conf b/compose_compiler_config.conf index 2341256f4..d47946206 100644 --- a/compose_compiler_config.conf +++ b/compose_compiler_config.conf @@ -2,5 +2,10 @@ // It allows us to define classes that our not part of our codebase without wrapping them in a stable class. // For more information, check https://developer.android.com/jetpack/compose/performance/stability/fix#configuration-file +// We always use immutable classes for our data model, to avoid running the Compose compiler +// in the module we declare it to be stable here. +com.google.samples.apps.nowinandroid.core.model.data.* + +// Java standard library classes java.time.ZoneId java.time.ZoneOffset