From 3fd781e36cce3e4cdfd39e4ad0abaca86776730c Mon Sep 17 00:00:00 2001 From: Gabriel Ittner Date: Wed, 28 Jun 2023 11:30:07 +0200 Subject: [PATCH] rename DestinationComponent (#439) --- .../mad/whetstone/codegen/FileGeneratorTestCompose.kt | 8 ++++---- .../whetstone/codegen/FileGeneratorTestComposeFragment.kt | 8 ++++---- .../codegen/FileGeneratorTestRendererFragment.kt | 8 ++++---- .../com/freeletics/mad/whetstone/codegen/FileGenerator.kt | 4 ++-- ...ntGenerator.kt => NavDestinationComponentGenerator.kt} | 4 ++-- .../com/freeletics/mad/whetstone/codegen/util/External.kt | 2 +- ...DestinationComponent.kt => NavDestinationComponent.kt} | 2 +- .../java/com/freeletics/mad/whetstone/internal/NavFind.kt | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) rename whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/nav/{DestinationComponentGenerator.kt => NavDestinationComponentGenerator.kt} (90%) rename whetstone/navigation/src/main/java/com/freeletics/mad/whetstone/internal/{DestinationComponent.kt => NavDestinationComponent.kt} (80%) diff --git a/whetstone/compiler-test/src/test/kotlin/com/freeletics/mad/whetstone/codegen/FileGeneratorTestCompose.kt b/whetstone/compiler-test/src/test/kotlin/com/freeletics/mad/whetstone/codegen/FileGeneratorTestCompose.kt index f7595ab09..52a6a30f2 100644 --- a/whetstone/compiler-test/src/test/kotlin/com/freeletics/mad/whetstone/codegen/FileGeneratorTestCompose.kt +++ b/whetstone/compiler-test/src/test/kotlin/com/freeletics/mad/whetstone/codegen/FileGeneratorTestCompose.kt @@ -356,8 +356,8 @@ internal class FileGeneratorTestCompose { import com.freeletics.mad.navigator.compose.ScreenDestination import com.freeletics.mad.whetstone.NavEntry import com.freeletics.mad.whetstone.ScopeTo - import com.freeletics.mad.whetstone.`internal`.DestinationComponent import com.freeletics.mad.whetstone.`internal`.InternalWhetstoneApi + import com.freeletics.mad.whetstone.`internal`.NavDestinationComponent import com.freeletics.mad.whetstone.`internal`.NavEntryComponentGetter import com.freeletics.mad.whetstone.`internal`.NavEntryComponentGetterKey import com.freeletics.mad.whetstone.`internal`.asComposeState @@ -513,7 +513,7 @@ internal class FileGeneratorTestCompose { @ContributesTo(TestDestinationScope::class) @OptIn(InternalWhetstoneApi::class) - public interface WhetstoneTestScreenNavEntryDestinationComponent : DestinationComponent + public interface WhetstoneTestScreenNavEntryNavDestinationComponent : NavDestinationComponent """.trimIndent() @@ -574,8 +574,8 @@ internal class FileGeneratorTestCompose { import com.freeletics.mad.whetstone.AppScope import com.freeletics.mad.whetstone.NavEntry import com.freeletics.mad.whetstone.ScopeTo - import com.freeletics.mad.whetstone.`internal`.DestinationComponent import com.freeletics.mad.whetstone.`internal`.InternalWhetstoneApi + import com.freeletics.mad.whetstone.`internal`.NavDestinationComponent import com.freeletics.mad.whetstone.`internal`.NavEntryComponentGetter import com.freeletics.mad.whetstone.`internal`.NavEntryComponentGetterKey import com.freeletics.mad.whetstone.`internal`.asComposeState @@ -728,7 +728,7 @@ internal class FileGeneratorTestCompose { @ContributesTo(AppScope::class) @OptIn(InternalWhetstoneApi::class) - public interface WhetstoneTestScreenNavEntryDestinationComponent : DestinationComponent + public interface WhetstoneTestScreenNavEntryNavDestinationComponent : NavDestinationComponent """.trimIndent() diff --git a/whetstone/compiler-test/src/test/kotlin/com/freeletics/mad/whetstone/codegen/FileGeneratorTestComposeFragment.kt b/whetstone/compiler-test/src/test/kotlin/com/freeletics/mad/whetstone/codegen/FileGeneratorTestComposeFragment.kt index e1cb50b8a..2f1b660d0 100644 --- a/whetstone/compiler-test/src/test/kotlin/com/freeletics/mad/whetstone/codegen/FileGeneratorTestComposeFragment.kt +++ b/whetstone/compiler-test/src/test/kotlin/com/freeletics/mad/whetstone/codegen/FileGeneratorTestComposeFragment.kt @@ -412,8 +412,8 @@ internal class FileGeneratorTestComposeFragment { import com.freeletics.mad.navigator.fragment.requireRoute import com.freeletics.mad.whetstone.NavEntry import com.freeletics.mad.whetstone.ScopeTo - import com.freeletics.mad.whetstone.`internal`.DestinationComponent import com.freeletics.mad.whetstone.`internal`.InternalWhetstoneApi + import com.freeletics.mad.whetstone.`internal`.NavDestinationComponent import com.freeletics.mad.whetstone.`internal`.NavEntryComponentGetter import com.freeletics.mad.whetstone.`internal`.NavEntryComponentGetterKey import com.freeletics.mad.whetstone.`internal`.asComposeState @@ -585,7 +585,7 @@ internal class FileGeneratorTestComposeFragment { @ContributesTo(TestDestinationScope::class) @OptIn(InternalWhetstoneApi::class) - public interface WhetstoneTestScreenNavEntryDestinationComponent : DestinationComponent + public interface WhetstoneTestScreenNavEntryNavDestinationComponent : NavDestinationComponent """.trimIndent() @@ -654,8 +654,8 @@ internal class FileGeneratorTestComposeFragment { import com.freeletics.mad.whetstone.AppScope import com.freeletics.mad.whetstone.NavEntry import com.freeletics.mad.whetstone.ScopeTo - import com.freeletics.mad.whetstone.`internal`.DestinationComponent import com.freeletics.mad.whetstone.`internal`.InternalWhetstoneApi + import com.freeletics.mad.whetstone.`internal`.NavDestinationComponent import com.freeletics.mad.whetstone.`internal`.NavEntryComponentGetter import com.freeletics.mad.whetstone.`internal`.NavEntryComponentGetterKey import com.freeletics.mad.whetstone.`internal`.asComposeState @@ -825,7 +825,7 @@ internal class FileGeneratorTestComposeFragment { @ContributesTo(AppScope::class) @OptIn(InternalWhetstoneApi::class) - public interface WhetstoneTestScreenNavEntryDestinationComponent : DestinationComponent + public interface WhetstoneTestScreenNavEntryNavDestinationComponent : NavDestinationComponent """.trimIndent() diff --git a/whetstone/compiler-test/src/test/kotlin/com/freeletics/mad/whetstone/codegen/FileGeneratorTestRendererFragment.kt b/whetstone/compiler-test/src/test/kotlin/com/freeletics/mad/whetstone/codegen/FileGeneratorTestRendererFragment.kt index 5c040c8b0..6911b8404 100644 --- a/whetstone/compiler-test/src/test/kotlin/com/freeletics/mad/whetstone/codegen/FileGeneratorTestRendererFragment.kt +++ b/whetstone/compiler-test/src/test/kotlin/com/freeletics/mad/whetstone/codegen/FileGeneratorTestRendererFragment.kt @@ -348,8 +348,8 @@ internal class FileGeneratorTestRendererFragment { import com.freeletics.mad.navigator.fragment.requireRoute import com.freeletics.mad.whetstone.NavEntry import com.freeletics.mad.whetstone.ScopeTo - import com.freeletics.mad.whetstone.`internal`.DestinationComponent import com.freeletics.mad.whetstone.`internal`.InternalWhetstoneApi + import com.freeletics.mad.whetstone.`internal`.NavDestinationComponent import com.freeletics.mad.whetstone.`internal`.NavEntryComponentGetter import com.freeletics.mad.whetstone.`internal`.NavEntryComponentGetterKey import com.freeletics.mad.whetstone.`internal`.navEntryComponent @@ -503,7 +503,7 @@ internal class FileGeneratorTestRendererFragment { @ContributesTo(TestDestinationScope::class) @OptIn(InternalWhetstoneApi::class) - public interface WhetstoneTestScreenNavEntryDestinationComponent : DestinationComponent + public interface WhetstoneTestScreenNavEntryNavDestinationComponent : NavDestinationComponent """.trimIndent() @@ -567,8 +567,8 @@ internal class FileGeneratorTestRendererFragment { import com.freeletics.mad.whetstone.AppScope import com.freeletics.mad.whetstone.NavEntry import com.freeletics.mad.whetstone.ScopeTo - import com.freeletics.mad.whetstone.`internal`.DestinationComponent import com.freeletics.mad.whetstone.`internal`.InternalWhetstoneApi + import com.freeletics.mad.whetstone.`internal`.NavDestinationComponent import com.freeletics.mad.whetstone.`internal`.NavEntryComponentGetter import com.freeletics.mad.whetstone.`internal`.NavEntryComponentGetterKey import com.freeletics.mad.whetstone.`internal`.navEntryComponent @@ -720,7 +720,7 @@ internal class FileGeneratorTestRendererFragment { @ContributesTo(AppScope::class) @OptIn(InternalWhetstoneApi::class) - public interface WhetstoneTestScreenNavEntryDestinationComponent : DestinationComponent + public interface WhetstoneTestScreenNavEntryNavDestinationComponent : NavDestinationComponent """.trimIndent() diff --git a/whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/FileGenerator.kt b/whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/FileGenerator.kt index 1da75775a..c501c884b 100644 --- a/whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/FileGenerator.kt +++ b/whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/FileGenerator.kt @@ -11,7 +11,7 @@ import com.freeletics.mad.whetstone.codegen.common.ModuleGenerator import com.freeletics.mad.whetstone.codegen.compose.ComposeScreenGenerator import com.freeletics.mad.whetstone.codegen.fragment.ComposeFragmentGenerator import com.freeletics.mad.whetstone.codegen.fragment.RendererFragmentGenerator -import com.freeletics.mad.whetstone.codegen.nav.DestinationComponentGenerator +import com.freeletics.mad.whetstone.codegen.nav.NavDestinationComponentGenerator import com.freeletics.mad.whetstone.codegen.nav.NavDestinationModuleGenerator import com.freeletics.mad.whetstone.codegen.nav.NavEntryComponentGetterGenerator import com.squareup.kotlinpoet.FileSpec @@ -85,7 +85,7 @@ public class FileGenerator { val componentGenerator = ComponentGenerator(data) val moduleGenerator = ModuleGenerator(data) val componentGetterGenerator = NavEntryComponentGetterGenerator(data) - val destinationComponentGenerator = DestinationComponentGenerator(data) + val destinationComponentGenerator = NavDestinationComponentGenerator(data) addType(componentGenerator.generate()) addType(moduleGenerator.generate()) diff --git a/whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/nav/DestinationComponentGenerator.kt b/whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/nav/NavDestinationComponentGenerator.kt similarity index 90% rename from whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/nav/DestinationComponentGenerator.kt rename to whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/nav/NavDestinationComponentGenerator.kt index 5919f4dbb..beed61b54 100644 --- a/whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/nav/DestinationComponentGenerator.kt +++ b/whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/nav/NavDestinationComponentGenerator.kt @@ -7,12 +7,12 @@ import com.freeletics.mad.whetstone.codegen.util.destinationComponent import com.freeletics.mad.whetstone.codegen.util.optInAnnotation import com.squareup.kotlinpoet.TypeSpec -internal class DestinationComponentGenerator( +internal class NavDestinationComponentGenerator( override val data: BaseData, ) : Generator() { fun generate(): TypeSpec { - return TypeSpec.interfaceBuilder("Whetstone${data.baseName}DestinationComponent") + return TypeSpec.interfaceBuilder("Whetstone${data.baseName}NavDestinationComponent") .addAnnotation(contributesToAnnotation(data.navigation!!.destinationScope)) .addAnnotation(optInAnnotation()) .addSuperinterface(destinationComponent) diff --git a/whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/util/External.kt b/whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/util/External.kt index 89a5283f2..48d7f23a1 100644 --- a/whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/util/External.kt +++ b/whetstone/compiler/src/main/kotlin/com/freeletics/mad/whetstone/codegen/util/External.kt @@ -34,7 +34,7 @@ internal val navEntryComponentGetterKey = ClassName( "com.freeletics.mad.whetstone.internal", "NavEntryComponentGetterKey", ) -internal val destinationComponent = ClassName("com.freeletics.mad.whetstone.internal", "DestinationComponent") +internal val destinationComponent = ClassName("com.freeletics.mad.whetstone.internal", "NavDestinationComponent") // Navigator internal val navEventNavigator = ClassName("com.freeletics.mad.navigator", "NavEventNavigator") diff --git a/whetstone/navigation/src/main/java/com/freeletics/mad/whetstone/internal/DestinationComponent.kt b/whetstone/navigation/src/main/java/com/freeletics/mad/whetstone/internal/NavDestinationComponent.kt similarity index 80% rename from whetstone/navigation/src/main/java/com/freeletics/mad/whetstone/internal/DestinationComponent.kt rename to whetstone/navigation/src/main/java/com/freeletics/mad/whetstone/internal/NavDestinationComponent.kt index 7b0f8039f..a79ad4d0a 100644 --- a/whetstone/navigation/src/main/java/com/freeletics/mad/whetstone/internal/DestinationComponent.kt +++ b/whetstone/navigation/src/main/java/com/freeletics/mad/whetstone/internal/NavDestinationComponent.kt @@ -1,6 +1,6 @@ package com.freeletics.mad.whetstone.internal @InternalWhetstoneApi -public interface DestinationComponent { +public interface NavDestinationComponent { public val navEntryComponentGetters: @JvmSuppressWildcards Map, NavEntryComponentGetter> } diff --git a/whetstone/navigation/src/main/java/com/freeletics/mad/whetstone/internal/NavFind.kt b/whetstone/navigation/src/main/java/com/freeletics/mad/whetstone/internal/NavFind.kt index 3fe90046f..399a0d9f8 100644 --- a/whetstone/navigation/src/main/java/com/freeletics/mad/whetstone/internal/NavFind.kt +++ b/whetstone/navigation/src/main/java/com/freeletics/mad/whetstone/internal/NavFind.kt @@ -15,7 +15,7 @@ public fun Context.findComponentByScope( executor: NavigationExecutor, ): T { if (scope != destinationScope) { - val destinationComponent = find(destinationScope) as? DestinationComponent + val destinationComponent = find(destinationScope) as? NavDestinationComponent val getter = destinationComponent?.navEntryComponentGetters?.get(scope.java) if (getter != null) { @Suppress("UNCHECKED_CAST")