Skip to content

Commit

Permalink
build: fix gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 committed Jun 4, 2022
1 parent b5921e5 commit d297936
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
9 changes: 6 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.MavenPublishBasePlugin
import com.vanniktech.maven.publish.SonatypeHost
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.dokka.gradle.DokkaTask
Expand Down Expand Up @@ -188,10 +191,10 @@ spotless {
}

allprojects {
plugins.withId("com.vanniktech.maven.publish") {
mavenPublish {
plugins.withType<MavenPublishBasePlugin> {
extensions.configure<MavenPublishBaseExtension> {
publishToMavenCentral(SonatypeHost.S01)
enableReleaseSigning()
signAllPublications()
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/commonMain/kotlin/com/hoc081098/flowext/defer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,20 @@ import kotlinx.coroutines.flow.flow
*
* In some circumstances, waiting until the last minute (that is, until collection time)
* to generate the [Flow] can ensure that collectors receive the freshest data.
*
* Example of usage:
*
* ```
* suspend fun remoteCall1(): R1 = ...
* suspend fun remoteCall2(r1: R1): R2 = ...
*
* fun example1(): Flow<R2> = defer {
* val r1 = remoteCall1()
* val r2 = remoteCall2(r1)
* flowOf(r2)
* }
*
* fun example2(): Flow<R1> = defer { flowOf(remoteCall1()) }
* ```
*/
public fun <T> defer(flowFactory: suspend () -> Flow<T>): Flow<T> = flow { emitAll(flowFactory()) }

0 comments on commit d297936

Please sign in to comment.