Skip to content

Commit

Permalink
v4.0.0-dev1
Browse files Browse the repository at this point in the history
  • Loading branch information
ForteScarlet committed Jan 15, 2024
1 parent 9a472fc commit a8f1df8
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 6 deletions.
Empty file added .changelog/v4.0.0-dev1.md
Empty file.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# v4.0.0-dev1
> [!warning]
> 这是一个尚在开发中的**预览版**,它可能不稳定,可能会频繁变更,且没有可用性保证。

> Release & Pull Notes: [v4.0.0-dev1](https://github.com/simple-robot/simpler-robot/releases/tag/v4.0.0-dev1)
- feat: Collectable ([`5d145237`](https://github.com/simple-robot/simpler-robot/commit/5d145237))
- feat: ID、Timestamp and Job link ([`60f8634f`](https://github.com/simple-robot/simpler-robot/commit/60f8634f))
- feat: Timestamp ([`3db7aa8f`](https://github.com/simple-robot/simpler-robot/commit/3db7aa8f))
- feat: (WIP) multiplatform ID ([`5eafba6e..1727015e`](https://github.com/simple-robot/simpler-robot/compare/5eafba6e..v3.3.0))

<details><summary><code>5eafba6e..1727015e</code></summary>

- [`5eafba6e`](https://github.com/simple-robot/simpler-robot/commit/5eafba6e)
- [`3e0919a2`](https://github.com/simple-robot/simpler-robot/commit/3e0919a2)
- [`1727015e`](https://github.com/simple-robot/simpler-robot/commit/1727015e)

</details>


# v3.3.0

> Release & Pull Notes: [v3.3.0](https://github.com/simple-robot/simpler-robot/releases/tag/v3.3.0)
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ plugins {
id("com.github.gmazzo.buildconfig") version "4.1.2" apply false
id("io.gitlab.arturbosch.detekt")
id("simbot.nexus-publish")
id("simbot.changelog-generator")
}

setup(P.Simbot)
Expand Down
9 changes: 9 additions & 0 deletions buildSrc/src/main/kotlin/changelog/GenerateChangelog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ fun Project.generateChangelog(tag: String) {

FileWriter(rootChangelogFile).buffered().use { writer ->
writer.appendLine("# $tag")
if ("-dev" in tag) {
writer.appendLine(
"""
> [!warning]
> 这是一个尚在开发中的**预览版**,它可能不稳定,可能会频繁变更,且没有可用性保证。
""".trimIndent()
)
}
writer.appendLine(
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ package love.forte.simbot.event
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName
import kotlin.jvm.JvmSynthetic
Expand Down Expand Up @@ -179,6 +180,32 @@ public interface EventProcessor {
}


/**
* 将事件推送并异步处理。
*/
@JvmSynthetic
public fun EventProcessor.pushAndLaunch(
scope: CoroutineScope,
event: Event,
collector: FlowCollector<EventResult>? = null,
): Job = scope.launch {
with(push(event)) {
if (collector != null) collect(collector) else collect()
}
}

/**
* 将事件推送并异步处理。
*/
@JvmSynthetic
public inline fun EventProcessor.pushAndLaunchThen(
scope: CoroutineScope,
event: Event,
crossinline useFlow: (Flow<EventResult>) -> Unit
): Job = scope.launch {
useFlow(push(event))
}

/**
* 将事件推送并收集处理。
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@

package love.forte.simbot.suspendrunner

import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.test.runTest
import love.forte.simbot.annotations.InternalSimbotAPI
import love.forte.simbot.suspendrunner.reserve.mono
import love.forte.simbot.suspendrunner.reserve.suspendReserve
import reactor.test.StepVerifier
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.test.Test


Expand All @@ -40,10 +39,10 @@ import kotlin.test.Test
*/
class JvmReserveTests {

@OptIn(InternalSimbotAPI::class, DelicateCoroutinesApi::class)
@OptIn(InternalSimbotAPI::class)
@Test
fun jvmReserveMonoTest() {
val reserve = suspendReserve(GlobalScope, EmptyCoroutineContext) { run() }
fun jvmReserveMonoTest() = runTest {
val reserve = suspendReserve(this, Dispatchers.Default) { run() }
val mono = reserve.transform(mono())

StepVerifier.create(mono)
Expand Down

0 comments on commit a8f1df8

Please sign in to comment.