Skip to content

Commit

Permalink
Change bindServices() to be a suspending function (#2175)
Browse files Browse the repository at this point in the history
* Upgrade Zipline to 1.14.0

* Change bindServices() to be a suspending function
  • Loading branch information
squarejesse authored Jul 9, 2024
1 parent 8df79ee commit efa0c27
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ New:

Changed:
- The `TreehouseApp` type is now an abstract class. This should make it easier to write unit tests for code that integrates Treehouse.
- The `TreehouseApp.Spec.bindServices()` function is now suspending.

Fixed:
- Using a `data object` for a widget of modifier no longer causes schema parsing to crash.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public abstract interface class app/cash/redwood/treehouse/TreehouseApp$Factory

public abstract class app/cash/redwood/treehouse/TreehouseApp$Spec {
public fun <init> ()V
public abstract fun bindServices (Lapp/cash/zipline/Zipline;)V
public abstract fun bindServices (Lapp/cash/zipline/Zipline;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun create (Lapp/cash/zipline/Zipline;)Lapp/cash/redwood/treehouse/AppService;
public fun getFreshnessChecker ()Lapp/cash/zipline/loader/FreshnessChecker;
public fun getLoadCodeFromNetworkOnly ()Z
Expand Down
2 changes: 1 addition & 1 deletion redwood-treehouse-host/api/jvm/redwood-treehouse-host.api
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public abstract interface class app/cash/redwood/treehouse/TreehouseApp$Factory

public abstract class app/cash/redwood/treehouse/TreehouseApp$Spec {
public fun <init> ()V
public abstract fun bindServices (Lapp/cash/zipline/Zipline;)V
public abstract fun bindServices (Lapp/cash/zipline/Zipline;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun create (Lapp/cash/zipline/Zipline;)Lapp/cash/redwood/treehouse/AppService;
public fun getFreshnessChecker ()Lapp/cash/zipline/loader/FreshnessChecker;
public fun getLoadCodeFromNetworkOnly ()Z
Expand Down
2 changes: 1 addition & 1 deletion redwood-treehouse-host/api/redwood-treehouse-host.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ abstract class <#A: app.cash.redwood.treehouse/AppService> app.cash.redwood.tree
open val serializersModule // app.cash.redwood.treehouse/TreehouseApp.Spec.serializersModule|{}serializersModule[0]
open fun <get-serializersModule>(): kotlinx.serialization.modules/SerializersModule // app.cash.redwood.treehouse/TreehouseApp.Spec.serializersModule.<get-serializersModule>|<get-serializersModule>(){}[0]

abstract fun bindServices(app.cash.zipline/Zipline) // app.cash.redwood.treehouse/TreehouseApp.Spec.bindServices|bindServices(app.cash.zipline.Zipline){}[0]
abstract fun create(app.cash.zipline/Zipline): #A1 // app.cash.redwood.treehouse/TreehouseApp.Spec.create|create(app.cash.zipline.Zipline){}[0]
abstract suspend fun bindServices(app.cash.zipline/Zipline) // app.cash.redwood.treehouse/TreehouseApp.Spec.bindServices|bindServices(app.cash.zipline.Zipline){}[0]
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ internal class TreehouseTester(
override val loadCodeFromNetworkOnly: Boolean
get() = true

override fun bindServices(zipline: Zipline) {
override suspend fun bindServices(zipline: Zipline) {
zipline.bind("HostApi", hostApi)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ public abstract class TreehouseApp<A : AppService> : AutoCloseable {
public open val loadCodeFromNetworkOnly: Boolean
get() = false

public abstract fun bindServices(zipline: Zipline)
public abstract suspend fun bindServices(zipline: Zipline)

public abstract fun create(zipline: Zipline): A
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class EmojiSearchAppSpec(
override fun isFresh(manifest: ZiplineManifest, freshAtEpochMs: Long) = true
}

override fun bindServices(zipline: Zipline) {
override suspend fun bindServices(zipline: Zipline) {
zipline.bind<HostApi>("HostApi", hostApi)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TestAppSpec(
override fun isFresh(manifest: ZiplineManifest, freshAtEpochMs: Long) = true
}

override fun bindServices(zipline: Zipline) {
override suspend fun bindServices(zipline: Zipline) {
zipline.bind<HostApi>("HostApi", hostApi)
}

Expand Down

0 comments on commit efa0c27

Please sign in to comment.