Skip to content

A fully functional Android app built entirely with Kotlin and Jetpack Compose

Enable strong skipping

Ben Trengrove5be13a047b35
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<String> {
"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