Skip to content

Commit

Permalink
Delete generated typealiases for migration (#1943)
Browse files Browse the repository at this point in the history
0.10.0 was released. These won't be in 0.11.0.
  • Loading branch information
JakeWharton authored Apr 10, 2024
1 parent 86bff1d commit ba29875
Show file tree
Hide file tree
Showing 17 changed files with 13 additions and 122 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ New:
- Nothing yet!

Changed:
- Removed generated `typealias`es for package names which changed in 0.10.0.
- In `UIViewLazyList`'s `UITableView`, adding special-case handling for programmatic scroll-to-top calls.

Fixed:
Expand Down
5 changes: 0 additions & 5 deletions redwood-layout-testing/api/redwood-layout-testing.api
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,3 @@ public final class app/cash/redwood/layout/testing/SpacerValue : app/cash/redwoo
public fun toWidget (Lapp/cash/redwood/widget/WidgetSystem;)Lapp/cash/redwood/widget/Widget;
}

public final class app/cash/redwood/layout/widget/TestingDeprecatedKt {
public static final fun RedwoodLayoutTester (Lapp/cash/redwood/ui/OnBackPressedDispatcher;Lapp/cash/redwood/testing/TestSavedState;Lapp/cash/redwood/ui/UiConfiguration;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun RedwoodLayoutTester$default (Lapp/cash/redwood/ui/OnBackPressedDispatcher;Lapp/cash/redwood/testing/TestSavedState;Lapp/cash/redwood/ui/UiConfiguration;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}

1 change: 0 additions & 1 deletion redwood-layout-testing/api/redwood-layout-testing.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,3 @@ final class app.cash.redwood.layout.testing/SpacerValue : app.cash.redwood.testi
final fun <get-width>(): app.cash.redwood.ui/Dp // app.cash.redwood.layout.testing/SpacerValue.width.<get-width>|<get-width>(){}[0]
}
final suspend fun <#A: kotlin/Any?> app.cash.redwood.layout.testing/RedwoodLayoutTester(app.cash.redwood.ui/OnBackPressedDispatcher =..., app.cash.redwood.testing/TestSavedState? =..., app.cash.redwood.ui/UiConfiguration =..., kotlin.coroutines/SuspendFunction1<app.cash.redwood.testing/TestRedwoodComposition<kotlin.collections/List<app.cash.redwood.testing/WidgetValue>>, #A>): #A // app.cash.redwood.layout.testing/RedwoodLayoutTester|RedwoodLayoutTester(app.cash.redwood.ui.OnBackPressedDispatcher;app.cash.redwood.testing.TestSavedState?;app.cash.redwood.ui.UiConfiguration;kotlin.coroutines.SuspendFunction1<app.cash.redwood.testing.TestRedwoodComposition<kotlin.collections.List<app.cash.redwood.testing.WidgetValue>>,0:0>){0§<kotlin.Any?>}[0]
final suspend fun <#A: kotlin/Any?> app.cash.redwood.layout.widget/RedwoodLayoutTester(app.cash.redwood.ui/OnBackPressedDispatcher =..., app.cash.redwood.testing/TestSavedState? =..., app.cash.redwood.ui/UiConfiguration =..., kotlin.coroutines/SuspendFunction1<app.cash.redwood.testing/TestRedwoodComposition<kotlin.collections/List<app.cash.redwood.testing/WidgetValue>>, #A>): #A // app.cash.redwood.layout.widget/RedwoodLayoutTester|RedwoodLayoutTester(app.cash.redwood.ui.OnBackPressedDispatcher;app.cash.redwood.testing.TestSavedState?;app.cash.redwood.ui.UiConfiguration;kotlin.coroutines.SuspendFunction1<app.cash.redwood.testing.TestRedwoodComposition<kotlin.collections.List<app.cash.redwood.testing.WidgetValue>>,0:0>){0§<kotlin.Any?>}[0]
5 changes: 0 additions & 5 deletions redwood-lazylayout-testing/api/redwood-lazylayout-testing.api
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,3 @@ public final class app/cash/redwood/lazylayout/testing/RefreshableLazyListValue
public fun toWidget (Lapp/cash/redwood/widget/WidgetSystem;)Lapp/cash/redwood/widget/Widget;
}

public final class app/cash/redwood/lazylayout/widget/TestingDeprecatedKt {
public static final fun RedwoodLazyLayoutTester (Lapp/cash/redwood/ui/OnBackPressedDispatcher;Lapp/cash/redwood/testing/TestSavedState;Lapp/cash/redwood/ui/UiConfiguration;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun RedwoodLazyLayoutTester$default (Lapp/cash/redwood/ui/OnBackPressedDispatcher;Lapp/cash/redwood/testing/TestSavedState;Lapp/cash/redwood/ui/UiConfiguration;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}

Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,3 @@ final class app.cash.redwood.lazylayout.testing/RefreshableLazyListValue : app.c
final fun <get-width>(): app.cash.redwood.layout.api/Constraint // app.cash.redwood.lazylayout.testing/RefreshableLazyListValue.width.<get-width>|<get-width>(){}[0]
}
final suspend fun <#A: kotlin/Any?> app.cash.redwood.lazylayout.testing/RedwoodLazyLayoutTester(app.cash.redwood.ui/OnBackPressedDispatcher =..., app.cash.redwood.testing/TestSavedState? =..., app.cash.redwood.ui/UiConfiguration =..., kotlin.coroutines/SuspendFunction1<app.cash.redwood.testing/TestRedwoodComposition<kotlin.collections/List<app.cash.redwood.testing/WidgetValue>>, #A>): #A // app.cash.redwood.lazylayout.testing/RedwoodLazyLayoutTester|RedwoodLazyLayoutTester(app.cash.redwood.ui.OnBackPressedDispatcher;app.cash.redwood.testing.TestSavedState?;app.cash.redwood.ui.UiConfiguration;kotlin.coroutines.SuspendFunction1<app.cash.redwood.testing.TestRedwoodComposition<kotlin.collections.List<app.cash.redwood.testing.WidgetValue>>,0:0>){0§<kotlin.Any?>}[0]
final suspend fun <#A: kotlin/Any?> app.cash.redwood.lazylayout.widget/RedwoodLazyLayoutTester(app.cash.redwood.ui/OnBackPressedDispatcher =..., app.cash.redwood.testing/TestSavedState? =..., app.cash.redwood.ui/UiConfiguration =..., kotlin.coroutines/SuspendFunction1<app.cash.redwood.testing/TestRedwoodComposition<kotlin.collections/List<app.cash.redwood.testing/WidgetValue>>, #A>): #A // app.cash.redwood.lazylayout.widget/RedwoodLazyLayoutTester|RedwoodLazyLayoutTester(app.cash.redwood.ui.OnBackPressedDispatcher;app.cash.redwood.testing.TestSavedState?;app.cash.redwood.ui.UiConfiguration;kotlin.coroutines.SuspendFunction1<app.cash.redwood.testing.TestRedwoodComposition<kotlin.collections.List<app.cash.redwood.testing.WidgetValue>>,0:0>){0§<kotlin.Any?>}[0]
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import assertk.assertions.isEmpty
import assertk.assertions.isEqualTo
import com.example.redwood.testing.protocol.guest.TestSchemaProtocolBridge
import com.example.redwood.testing.protocol.host.TestSchemaProtocolFactory
import com.example.redwood.testing.testing.TestSchemaTester
import com.example.redwood.testing.testing.TestSchemaTestingWidgetFactory
import com.example.redwood.testing.widget.TestSchemaTester
import com.example.redwood.testing.widget.TestSchemaWidgetSystem
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.coroutineScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ internal fun SchemaSet.generateFileSpecs(type: CodegenType): List<FileSpec> {
}

Testing -> {
add(testingDeprecations(schema))
add(generateTester(this@generateFileSpecs))
add(generateMutableWidgetFactory(schema))
for (widget in schema.widgets) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ internal fun ProtocolSchemaSet.generateFileSpecs(type: ProtocolCodegenType): Lis
return buildList {
when (type) {
Guest -> {
add(protocolGuestDeprecations(schema))
add(generateProtocolBridge(this@generateFileSpecs))
add(generateComposeProtocolModifierSerialization(this@generateFileSpecs))
for (dependency in all) {
Expand All @@ -49,7 +48,6 @@ internal fun ProtocolSchemaSet.generateFileSpecs(type: ProtocolCodegenType): Lis
}

Host -> {
add(protocolHostDeprecations(schema))
add(generateProtocolFactory(this@generateFileSpecs))
for (dependency in all) {
generateProtocolModifierImpls(dependency, host = schema)?.let { add(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,13 @@ import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
import com.squareup.kotlinpoet.PropertySpec
import com.squareup.kotlinpoet.SHORT
import com.squareup.kotlinpoet.STRING
import com.squareup.kotlinpoet.TypeAliasSpec
import com.squareup.kotlinpoet.TypeName
import com.squareup.kotlinpoet.TypeSpec
import com.squareup.kotlinpoet.UNIT
import com.squareup.kotlinpoet.joinToCode

private val protocolViewType = UNIT

// TODO Delete this once 0.10.0 is released.
internal fun protocolGuestDeprecations(schema: Schema): FileSpec {
val typeName = "${schema.type.flatName}ProtocolBridge"
val newType = ClassName(schema.guestProtocolPackage(), typeName)
return FileSpec.builder(schema.composePackage(), "protocolGuestDeprecated")
.addAnnotation(suppressDeprecations)
.addTypeAlias(
TypeAliasSpec.builder(typeName, newType)
.addAnnotation(
AnnotationSpec.builder(Deprecated::class)
.addMember("%S", "Change import to .protocol.guest.$typeName")
.build(),
)
.build(),
)
.build()
}

/*
class ExampleProtocolBridge private constructor(
private val state: ProtocolState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,12 @@ import com.squareup.kotlinpoet.MemberName
import com.squareup.kotlinpoet.ParameterSpec
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
import com.squareup.kotlinpoet.PropertySpec
import com.squareup.kotlinpoet.TypeAliasSpec
import com.squareup.kotlinpoet.TypeName
import com.squareup.kotlinpoet.TypeSpec
import com.squareup.kotlinpoet.TypeVariableName
import com.squareup.kotlinpoet.UNIT
import com.squareup.kotlinpoet.buildCodeBlock
import com.squareup.kotlinpoet.joinToCode

// TODO Delete this once 0.10.0 is released.
internal fun protocolHostDeprecations(schema: Schema): FileSpec {
val typeName = "${schema.type.flatName}ProtocolFactory"
val newType = ClassName(schema.hostProtocolPackage(), typeName)
val unboundW = TypeVariableName("V")
return FileSpec.builder(schema.widgetPackage(), "protocolHostDeprecated")
.addAnnotation(suppressDeprecations)
.addTypeAlias(
TypeAliasSpec.builder(typeName, newType.parameterizedBy(unboundW))
.addTypeVariable(unboundW)
.addAnnotation(
AnnotationSpec.builder(Deprecated::class)
.addMember("%S", "Change import to .protocol.host.$typeName")
.build(),
)
.build(),
)
.build()
}

/*
@ObjCName("ExampleProtocolFactory", exact = true)
public class ExampleProtocolFactory<W : Any>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import app.cash.redwood.tooling.schema.Widget.Children
import app.cash.redwood.tooling.schema.Widget.Event
import app.cash.redwood.tooling.schema.Widget.Property
import com.squareup.kotlinpoet.ANY
import com.squareup.kotlinpoet.AnnotationSpec
import com.squareup.kotlinpoet.BOOLEAN
import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.CodeBlock
Expand All @@ -39,64 +38,11 @@ import com.squareup.kotlinpoet.MemberName
import com.squareup.kotlinpoet.ParameterSpec
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
import com.squareup.kotlinpoet.PropertySpec
import com.squareup.kotlinpoet.TypeAliasSpec
import com.squareup.kotlinpoet.TypeName
import com.squareup.kotlinpoet.TypeSpec
import com.squareup.kotlinpoet.TypeVariableName
import com.squareup.kotlinpoet.joinToCode

// TODO Delete this once 0.10.0 is released.
internal fun testingDeprecations(schema: Schema): FileSpec {
val typeVarR = TypeVariableName("R")
val testingFunctionBodyType = LambdaTypeName.get(
receiver = RedwoodTesting.TestRedwoodComposition
.parameterizedBy(LIST.parameterizedBy(RedwoodTesting.WidgetValue)),
returnType = typeVarR,
).copy(suspending = true)
val testingFunctionName = "${schema.type.flatName}Tester"
val deprecation = AnnotationSpec.builder(Deprecated::class)
.addMember("%S", "Change import to .testing.$testingFunctionName")
.build()
return FileSpec.builder(schema.widgetPackage(), "testingDeprecated")
.addAnnotation(suppressDeprecations)
.addFunction(
FunSpec.builder(testingFunctionName)
.addAnnotation(deprecation)
.addModifiers(SUSPEND)
.addParameter(
ParameterSpec.builder("onBackPressedDispatcher", Redwood.OnBackPressedDispatcher)
.defaultValue("%T", RedwoodTesting.NoOpOnBackPressedDispatcher)
.build(),
)
.addParameter(
ParameterSpec.builder("savedState", RedwoodTesting.TestSavedState.copy(nullable = true))
.defaultValue("null")
.build(),
)
.addParameter(
ParameterSpec.builder("uiConfiguration", Redwood.UiConfiguration)
.defaultValue("%T()", Redwood.UiConfiguration)
.build(),
)
.addParameter("body", testingFunctionBodyType)
.addTypeVariable(typeVarR)
.returns(typeVarR)
.addStatement("return %M(onBackPressedDispatcher, savedState, uiConfiguration, body)", MemberName(schema.testingPackage(), testingFunctionName))
.build(),
)
.apply {
for (widget in schema.widgets) {
val valueType = schema.widgetValueType(widget)
addTypeAlias(
TypeAliasSpec.builder(valueType.simpleName, valueType)
.addAnnotation(deprecation)
.build(),
)
}
}
.build()
}

/*
suspend fun <R> ExampleTester(
onBackPressedDispatcher: OnBackPressedDispatcher = NoOpOnBackPressedDispatcher,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import app.cash.redwood.testing.WidgetValue
import app.cash.redwood.testing.flatten
import assertk.assertThat
import assertk.assertions.isEqualTo
import com.example.redwood.counter.widget.ButtonValue
import com.example.redwood.counter.widget.SchemaTester
import com.example.redwood.counter.widget.TextValue
import com.example.redwood.counter.testing.ButtonValue
import com.example.redwood.counter.testing.SchemaTester
import com.example.redwood.counter.testing.TextValue
import kotlin.test.Test
import kotlinx.coroutines.test.runTest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ import coil3.serviceLoaderEnabled
import com.example.redwood.emojisearch.composeui.ComposeUiEmojiSearchWidgetFactory
import com.example.redwood.emojisearch.composeui.EmojiSearchTheme
import com.example.redwood.emojisearch.launcher.EmojiSearchAppSpec
import com.example.redwood.emojisearch.protocol.host.EmojiSearchProtocolFactory
import com.example.redwood.emojisearch.treehouse.EmojiSearchPresenter
import com.example.redwood.emojisearch.widget.EmojiSearchProtocolFactory
import com.example.redwood.emojisearch.widget.EmojiSearchWidgetSystem
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ import app.cash.zipline.loader.ManifestVerifier
import app.cash.zipline.loader.asZiplineHttpClient
import app.cash.zipline.loader.withDevelopmentServerPush
import com.example.redwood.emojisearch.launcher.EmojiSearchAppSpec
import com.example.redwood.emojisearch.protocol.host.EmojiSearchProtocolFactory
import com.example.redwood.emojisearch.treehouse.EmojiSearchPresenter
import com.example.redwood.emojisearch.treehouse.emojiSearchSerializersModule
import com.example.redwood.emojisearch.widget.EmojiSearchProtocolFactory
import com.example.redwood.emojisearch.widget.EmojiSearchWidgetSystem
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.snackbar.Snackbar.LENGTH_INDEFINITE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import app.cash.redwood.treehouse.TreehouseUIView
import app.cash.redwood.treehouse.TreehouseView
import app.cash.redwood.treehouse.TreehouseView.WidgetSystem
import app.cash.redwood.treehouse.bindWhenReady
import com.example.redwood.emojisearch.widget.EmojiSearchProtocolFactory
import com.example.redwood.emojisearch.protocol.host.EmojiSearchProtocolFactory
import com.example.redwood.emojisearch.widget.EmojiSearchWidgetFactory
import com.example.redwood.emojisearch.widget.EmojiSearchWidgetSystem
import okio.ByteString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package com.example.redwood.emojisearch.treehouse
import app.cash.redwood.treehouse.StandardAppLifecycle
import app.cash.redwood.treehouse.ZiplineTreehouseUi
import app.cash.redwood.treehouse.asZiplineTreehouseUi
import com.example.redwood.emojisearch.compose.EmojiSearchProtocolBridge
import com.example.redwood.emojisearch.presenter.EmojiSearchTreehouseUi
import com.example.redwood.emojisearch.presenter.Navigator
import com.example.redwood.emojisearch.protocol.guest.EmojiSearchProtocolBridge
import kotlinx.serialization.json.Json

class RealEmojiSearchPresenter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import app.cash.redwood.layout.compose.Column
import app.cash.redwood.layout.widget.ColumnValue
import app.cash.redwood.layout.testing.ColumnValue
import app.cash.redwood.testing.flatten
import assertk.assertThat
import assertk.assertions.containsExactly
import com.example.redwood.emojisearch.compose.Text
import com.example.redwood.emojisearch.compose.TextInput
import com.example.redwood.emojisearch.widget.EmojiSearchTester
import com.example.redwood.emojisearch.widget.TextInputValue
import com.example.redwood.emojisearch.widget.TextValue
import com.example.redwood.emojisearch.testing.EmojiSearchTester
import com.example.redwood.emojisearch.testing.TextInputValue
import com.example.redwood.emojisearch.testing.TextValue
import example.values.TextFieldState
import kotlin.test.Test
import kotlinx.coroutines.test.runTest
Expand Down

0 comments on commit ba29875

Please sign in to comment.