Skip to content

Commit

Permalink
Rename protocol-guest package name to match artifact (#1646)
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeWharton authored Oct 27, 2023
1 parent 85cc945 commit 1473ab0
Show file tree
Hide file tree
Showing 25 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion redwood-protocol-guest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ kotlin {

sourceSets {
commonMain {
kotlin.srcDir(ComposeHelpers.get(tasks, 'app.cash.redwood.protocol.compose'))
kotlin.srcDir(ComposeHelpers.get(tasks, 'app.cash.redwood.protocol.guest'))
dependencies {
api projects.redwoodProtocol
api projects.redwoodCompose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

internal expect class PlatformList<E>() {
val size: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

internal expect class PlatformMap<K, V>() {
operator fun get(key: K): V?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

import app.cash.redwood.protocol.Change
import app.cash.redwood.protocol.ChildrenTag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

import app.cash.redwood.protocol.EventTag
import app.cash.redwood.protocol.Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

import app.cash.redwood.protocol.Change
import app.cash.redwood.protocol.ChildrenTag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

import app.cash.redwood.protocol.Event
import app.cash.redwood.protocol.Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

import app.cash.redwood.protocol.ChildrenChange
import app.cash.redwood.protocol.ChildrenTag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

import kotlin.time.Duration
import kotlinx.serialization.KSerializer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

import app.cash.redwood.Modifier
import app.cash.redwood.protocol.Create
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

import app.cash.redwood.protocol.EventTag
import app.cash.redwood.protocol.Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

import androidx.compose.runtime.BroadcastFrameClock
import androidx.compose.runtime.getValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

import app.cash.redwood.protocol.EventTag
import app.cash.redwood.protocol.Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

@JsName("Array")
internal external class JsArray<E> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

@JsName("Map")
internal external class JsMap<K, V> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

@Suppress(
"ACTUAL_TYPE_ALIAS_NOT_TO_CLASS", // ArrayList itself aliases to j.u.ArrayList on JVM.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.redwood.protocol.compose
package app.cash.redwood.protocol.guest

@Suppress(
"ACTUAL_TYPE_ALIAS_NOT_TO_CLASS", // LinkedHashMap itself aliases to j.u.LinkedHashMap on JVM.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package app.cash.redwood.testing

import app.cash.redwood.protocol.SnapshotChangeList
import app.cash.redwood.protocol.compose.ProtocolBridge
import app.cash.redwood.protocol.guest.ProtocolBridge
import kotlinx.serialization.json.Json

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import app.cash.redwood.protocol.ModifierChange
import app.cash.redwood.protocol.PropertyChange
import app.cash.redwood.protocol.PropertyTag
import app.cash.redwood.protocol.WidgetTag
import app.cash.redwood.protocol.compose.ProtocolRedwoodComposition
import app.cash.redwood.protocol.guest.ProtocolRedwoodComposition
import app.cash.redwood.protocol.widget.ProtocolBridge
import app.cash.redwood.ui.Cancellable
import app.cash.redwood.ui.OnBackPressedCallback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,22 @@ internal fun generateProtocolBridge(
return FileSpec.builder(type)
.addType(
TypeSpec.classBuilder(type)
.addSuperinterface(ComposeProtocol.ProtocolBridge)
.addSuperinterface(ProtocolGuest.ProtocolBridge)
.primaryConstructor(
FunSpec.constructorBuilder()
.addParameter("state", ComposeProtocol.ProtocolState)
.addParameter("mismatchHandler", ComposeProtocol.ProtocolMismatchHandler)
.addParameter("state", ProtocolGuest.ProtocolState)
.addParameter("mismatchHandler", ProtocolGuest.ProtocolMismatchHandler)
.addParameter("root", RedwoodWidget.WidgetChildren.parameterizedBy(NOTHING))
.addParameter("provider", providerType)
.build(),
)
.addProperty(
PropertySpec.builder("state", ComposeProtocol.ProtocolState, PRIVATE)
PropertySpec.builder("state", ProtocolGuest.ProtocolState, PRIVATE)
.initializer("state")
.build(),
)
.addProperty(
PropertySpec.builder("mismatchHandler", ComposeProtocol.ProtocolMismatchHandler, PRIVATE)
PropertySpec.builder("mismatchHandler", ProtocolGuest.ProtocolMismatchHandler, PRIVATE)
.initializer("mismatchHandler")
.build(),
)
Expand Down Expand Up @@ -139,14 +139,14 @@ internal fun generateProtocolBridge(
)
.addType(
TypeSpec.companionObjectBuilder()
.addSuperinterface(ComposeProtocol.ProtocolBridgeFactory)
.addSuperinterface(ProtocolGuest.ProtocolBridgeFactory)
.addFunction(
FunSpec.builder("create")
.addModifiers(OVERRIDE)
.addParameter("json", KotlinxSerialization.Json)
.addParameter("mismatchHandler", ComposeProtocol.ProtocolMismatchHandler)
.addParameter("mismatchHandler", ProtocolGuest.ProtocolMismatchHandler)
.returns(type)
.addStatement("val state = %T()", ComposeProtocol.ProtocolState)
.addStatement("val state = %T()", ProtocolGuest.ProtocolState)
.addStatement("val root = state.widgetChildren(%T.Root, %T.Root)", Protocol.Id, Protocol.ChildrenTag)
.apply {
val arguments = buildList {
Expand Down Expand Up @@ -201,13 +201,13 @@ internal fun generateProtocolWidgetFactory(
.addSuperinterface(schema.getWidgetFactoryType().parameterizedBy(NOTHING))
.primaryConstructor(
FunSpec.constructorBuilder()
.addParameter("state", ComposeProtocol.ProtocolState)
.addParameter("state", ProtocolGuest.ProtocolState)
.addParameter("json", KotlinxSerialization.Json)
.addParameter("mismatchHandler", ComposeProtocol.ProtocolMismatchHandler)
.addParameter("mismatchHandler", ProtocolGuest.ProtocolMismatchHandler)
.build(),
)
.addProperty(
PropertySpec.builder("state", ComposeProtocol.ProtocolState, PRIVATE)
PropertySpec.builder("state", ProtocolGuest.ProtocolState, PRIVATE)
.initializer("state")
.build(),
)
Expand All @@ -217,7 +217,7 @@ internal fun generateProtocolWidgetFactory(
.build(),
)
.addProperty(
PropertySpec.builder("mismatchHandler", ComposeProtocol.ProtocolMismatchHandler, PRIVATE)
PropertySpec.builder("mismatchHandler", ProtocolGuest.ProtocolMismatchHandler, PRIVATE)
.initializer("mismatchHandler")
.build(),
)
Expand Down Expand Up @@ -296,17 +296,17 @@ internal fun generateProtocolWidget(
.addType(
TypeSpec.classBuilder(type)
.addModifiers(INTERNAL)
.addSuperinterface(ComposeProtocol.ProtocolWidget)
.addSuperinterface(ProtocolGuest.ProtocolWidget)
.addSuperinterface(widgetName.parameterizedBy(NOTHING))
.primaryConstructor(
FunSpec.constructorBuilder()
.addParameter("state", ComposeProtocol.ProtocolState)
.addParameter("state", ProtocolGuest.ProtocolState)
.addParameter("json", KotlinxSerialization.Json)
.addParameter("mismatchHandler", ComposeProtocol.ProtocolMismatchHandler)
.addParameter("mismatchHandler", ProtocolGuest.ProtocolMismatchHandler)
.build(),
)
.addProperty(
PropertySpec.builder("state", ComposeProtocol.ProtocolState, PRIVATE)
PropertySpec.builder("state", ProtocolGuest.ProtocolState, PRIVATE)
.initializer("state")
.build(),
)
Expand All @@ -316,7 +316,7 @@ internal fun generateProtocolWidget(
.build(),
)
.addProperty(
PropertySpec.builder("mismatchHandler", ComposeProtocol.ProtocolMismatchHandler, PRIVATE)
PropertySpec.builder("mismatchHandler", ProtocolGuest.ProtocolMismatchHandler, PRIVATE)
.initializer("mismatchHandler")
.build(),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ internal object Protocol {
val WidgetTag = ClassName("app.cash.redwood.protocol", "WidgetTag")
}

internal object ComposeProtocol {
val ProtocolBridge = ClassName("app.cash.redwood.protocol.compose", "ProtocolBridge")
internal object ProtocolGuest {
val ProtocolBridge = ClassName("app.cash.redwood.protocol.guest", "ProtocolBridge")
val ProtocolBridgeFactory = ProtocolBridge.nestedClass("Factory")
val ProtocolState = ClassName("app.cash.redwood.protocol.compose", "ProtocolState")
val ProtocolState = ClassName("app.cash.redwood.protocol.guest", "ProtocolState")
val ProtocolMismatchHandler =
ClassName("app.cash.redwood.protocol.compose", "ProtocolMismatchHandler")
val ProtocolWidget = ClassName("app.cash.redwood.protocol.compose", "ProtocolWidget")
ClassName("app.cash.redwood.protocol.guest", "ProtocolMismatchHandler")
val ProtocolWidget = ClassName("app.cash.redwood.protocol.guest", "ProtocolWidget")
}

internal object WidgetProtocol {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import assertk.assertions.contains
import com.example.redwood.testing.TestSchema
import org.junit.Test

class ComposeProtocolGenerationTest {
class ProtocolGuestGenerationTest {
@Schema(
[
IdPropertyNameCollisionNode::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import androidx.compose.runtime.MonotonicFrameClock
import app.cash.redwood.protocol.EventTag
import app.cash.redwood.protocol.Id
import app.cash.redwood.protocol.WidgetTag
import app.cash.redwood.protocol.compose.ProtocolBridge
import app.cash.redwood.protocol.compose.ProtocolMismatchHandler
import app.cash.redwood.protocol.guest.ProtocolBridge
import app.cash.redwood.protocol.guest.ProtocolMismatchHandler
import app.cash.redwood.treehouse.AppLifecycle.Host
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package app.cash.redwood.treehouse
import androidx.compose.runtime.saveable.SaveableStateRegistry
import app.cash.redwood.compose.RedwoodComposition
import app.cash.redwood.protocol.EventSink
import app.cash.redwood.protocol.compose.ProtocolBridge
import app.cash.redwood.protocol.compose.ProtocolRedwoodComposition
import app.cash.redwood.protocol.guest.ProtocolBridge
import app.cash.redwood.protocol.guest.ProtocolRedwoodComposition
import app.cash.redwood.ui.Cancellable
import app.cash.redwood.ui.OnBackPressedCallback
import app.cash.redwood.ui.OnBackPressedDispatcher
Expand Down

0 comments on commit 1473ab0

Please sign in to comment.