From 65d7e4519ea75826d76c0e79fcc11fa586718430 Mon Sep 17 00:00:00 2001 From: Jaehwa Noh Date: Sat, 6 Jul 2024 20:18:38 +0900 Subject: [PATCH] Refactor to improve `FlavorDimension` extensibility, and replace to `register` lazy api. Change-Id: I6e2980f19da5a6e22a7773c84493424663e33fc4 --- .../com/google/samples/apps/nowinandroid/NiaFlavor.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/NiaFlavor.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/NiaFlavor.kt index 633098604..c3d996014 100644 --- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/NiaFlavor.kt +++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/NiaFlavor.kt @@ -21,13 +21,16 @@ enum class NiaFlavor(val dimension: FlavorDimension, val applicationIdSuffix: St fun configureFlavors( commonExtension: CommonExtension<*, *, *, *, *, *>, - flavorConfigurationBlock: ProductFlavor.(flavor: NiaFlavor) -> Unit = {} + flavorConfigurationBlock: ProductFlavor.(flavor: NiaFlavor) -> Unit = {}, ) { commonExtension.apply { - flavorDimensions += FlavorDimension.contentType.name + FlavorDimension.values().forEach { + flavorDimensions += it.name + } + productFlavors { NiaFlavor.values().forEach { - create(it.name) { + register(it.name) { dimension = it.dimension.name flavorConfigurationBlock(this, it) if (this@apply is ApplicationExtension && this is ApplicationProductFlavor) {