Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: v4.4.0 #897

Merged
merged 16 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .changelog/v4.4.0.md
Empty file.
9 changes: 8 additions & 1 deletion .github/workflows/publish-v4-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
JAVA_VERSION: 21
JAVA_DISTRIBUTION: zulu
GRADLE_VERSION: 8.5
NODE_VERSION: 22
IS_CI: true
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
Expand All @@ -30,6 +31,10 @@ jobs:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'

- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Run All Tests pre release
uses: gradle/actions/setup-gradle@v3
with:
Expand All @@ -56,7 +61,9 @@ jobs:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'

- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
# setup Gradle
- name: Gradle Publish Release
uses: gradle/actions/setup-gradle@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-v4-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ env:
JAVA_VERSION: 21
JAVA_DISTRIBUTION: zulu
GRADLE_VERSION: 8.5
NODE_VERSION: 22
IS_CI: true
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
Expand Down Expand Up @@ -49,7 +50,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 20
node-version: ${{ env.NODE_VERSION }}

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
Expand Down Expand Up @@ -79,10 +80,9 @@ jobs:
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'

# setup Node
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: ${{ env.NODE_VERSION }}

- name: Publish snapshots
uses: gradle/actions/setup-gradle@v3
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-v4-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:
JAVA_VERSION: 21
JAVA_DISTRIBUTION: zulu
GRADLE_VERSION: 8.5
NODE_VERSION: 22
IS_CI: true
GRADLE_OPTS: "-Dfile.encoding=UTF-8"

Expand All @@ -30,6 +31,9 @@ jobs:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Run V4 All Tests
uses: gradle/gradle-build-action@v3
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# v4.4.0

> Release & Pull Notes: [v4.4.0](https://github.com/simple-robot/simpler-robot/releases/tag/v4.4.0)

- fix(quantcat): 优化统一MergedBinder对null结果、失败结果的处理 ([`d741b8617`](https://github.com/simple-robot/simpler-robot/commit/d741b8617))
- feat(common-streamable): 增加模块与新的公共类型 Streamable, 用来简化部分针对 Sequence 类型的转化操作,例如在JVM中转为 Stream 和在 JS 中转为数组。 ([`1ba898c57`](https://github.com/simple-robot/simpler-robot/commit/1ba898c57))
- fix(quantcat): 优化统一MergedBinder对null结果、失败结果的处理 ([`9c5777847`](https://github.com/simple-robot/simpler-robot/commit/9c5777847))
- feat(common-streamable): 增加模块与新的公共类型 Streamable, 用来简化部分针对 Sequence 类型的转化操作,例如在JVM中转为 Stream 和在 JS 中转为数组。 ([`ca3eaa02b`](https://github.com/simple-robot/simpler-robot/commit/ca3eaa02b))

# v4.3.1

> Release & Pull Notes: [v4.3.1](https://github.com/simple-robot/simpler-robot/releases/tag/v4.3.1)
Expand Down
11 changes: 10 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,13 @@ idea {
}
}


// https://kotlinlang.org/docs/js-project-setup.html#node-js
rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().apply {
// CI 中配置环境,不再单独下载
if (isCi) {
download = false
}
}
// "true" for default behavior
}
30 changes: 14 additions & 16 deletions buildSrc/src/main/kotlin/JsConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@
*/

import org.gradle.api.Project
import org.gradle.kotlin.dsl.the
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmJsTargetDsl
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension


inline fun KotlinJsTargetDsl.configJs(
Expand Down Expand Up @@ -77,7 +74,8 @@ inline fun KotlinWasmJsTargetDsl.configWasmJs(
block: () -> Unit = {}
) {
if (nodeJs) {
nodejs()
nodejs {
}
}
// if (nodeJs && isLinux) {
// // win in candy node `21.0.0-v8-canary202309143a48826a08` is not supported
Expand All @@ -100,18 +98,18 @@ inline fun KotlinWasmJsTargetDsl.configWasmJs(
}

inline fun Project.configWasmJsTest(block: () -> Unit = {}) {
if (false) {
// see https://youtrack.jetbrains.com/issue/KT-63014/Running-tests-with-wasmJs-in-1.9.20-requires-Chrome-Canary#focus=Comments-27-8321383.0-0
rootProject.the<NodeJsRootExtension>().apply {
// nodeVersion = "21.0.0-v8-canary202309143a48826a08"
version = "21.0.0-v8-canary202309143a48826a08"
downloadBaseUrl = "https://nodejs.org/download/v8-canary"
}

tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().configureEach {
args.add("--ignore-engines")
}
}
// if (false) {
// // see https://youtrack.jetbrains.com/issue/KT-63014/Running-tests-with-wasmJs-in-1.9.20-requires-Chrome-Canary#focus=Comments-27-8321383.0-0
// rootProject.the<NodeJsRootExtension>().apply {
// // nodeVersion = "21.0.0-v8-canary202309143a48826a08"
// version = "21.0.0-v8-canary202309143a48826a08"
// downloadBaseUrl = "https://nodejs.org/download/v8-canary"
// }
//
// tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().configureEach {
// args.add("--ignore-engines")
// }
// }

block()
}
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/P.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ sealed class P(override val group: String) : ProjectDetail() {

*/
companion object {
const val VERSION = "4.3.1"
const val NEXT_VERSION = "4.3.2"
const val VERSION = "4.4.0"
const val NEXT_VERSION = "4.4.0"
const val SNAPSHOT_VERSION = "$VERSION-SNAPSHOT"
const val NEXT_SNAPSHOT_VERSION = "$NEXT_VERSION-SNAPSHOT"

Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ include(":simbot-gradles:simbot-gradle-suspendtransforms")

include(":simbot-commons:simbot-common-annotations")
include(":simbot-commons:simbot-common-collection")
include(":simbot-commons:simbot-common-streamable")
include(":simbot-commons:simbot-common-atomic")
include(":simbot-commons:simbot-common-apidefinition")
include(":simbot-commons:simbot-common-core")
Expand Down
4 changes: 4 additions & 0 deletions simbot-api/api/simbot-api.api
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ public abstract interface class love/forte/simbot/bot/BotManager : love/forte/si
public fun all (Llove/forte/simbot/common/id/ID;)Lkotlin/sequences/Sequence;
public fun allToList ()Ljava/util/List;
public fun allToList (Llove/forte/simbot/common/id/ID;)Ljava/util/List;
public fun allToStreamable ()Llove/forte/simbot/common/streamable/Streamable;
public fun allToStreamable (Llove/forte/simbot/common/id/ID;)Llove/forte/simbot/common/streamable/Streamable;
public fun asFuture ()Ljava/util/concurrent/CompletableFuture;
public abstract fun cancel (Ljava/lang/Throwable;)V
public static synthetic fun cancel$default (Llove/forte/simbot/bot/BotManager;Ljava/lang/Throwable;ILjava/lang/Object;)V
Expand All @@ -393,6 +395,7 @@ public final class love/forte/simbot/bot/BotManagerUtil {

public abstract interface class love/forte/simbot/bot/BotManagers : java/util/Collection, kotlin/jvm/internal/markers/KMappedMarker {
public fun allBots ()Lkotlin/sequences/Sequence;
public fun allBotsToStreamable ()Llove/forte/simbot/common/streamable/Streamable;
public fun firstBot ()Llove/forte/simbot/bot/Bot;
public fun firstBot (Llove/forte/simbot/common/id/ID;)Llove/forte/simbot/bot/Bot;
}
Expand Down Expand Up @@ -1206,6 +1209,7 @@ public abstract interface class love/forte/simbot/event/EventListener {

public abstract interface class love/forte/simbot/event/EventListenerContainer {
public abstract fun getListeners ()Lkotlin/sequences/Sequence;
public fun listenersToStreamable ()Llove/forte/simbot/common/streamable/Streamable;
}

public abstract interface class love/forte/simbot/event/EventListenerContext {
Expand Down
1 change: 1 addition & 0 deletions simbot-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ kotlin {
implementation(project(":simbot-commons:simbot-common-annotations"))
implementation(project(":simbot-logger"))

api(project(":simbot-commons:simbot-common-streamable"))
api(project(":simbot-commons:simbot-common-suspend-runner"))
api(project(":simbot-commons:simbot-common-core"))
api(project(":simbot-commons:simbot-common-collection"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import love.forte.simbot.ability.CompletionAware
import love.forte.simbot.ability.LifecycleAware
import love.forte.simbot.common.function.MergeableFactory
import love.forte.simbot.common.id.ID
import love.forte.simbot.common.streamable.Streamable
import love.forte.simbot.common.streamable.Streamable.Companion.asStreamable
import love.forte.simbot.plugin.PluginFactory
import love.forte.simbot.suspendrunner.ST

Expand Down Expand Up @@ -57,6 +59,24 @@ public interface BotManager : AutoConfigurableBotPlugin, LifecycleAware, Complet
*/
public fun all(id: ID): Sequence<Bot> = all().filter { bot -> bot.id == id }

/**
* 得到所有的 [Bot] 并转化为 [Streamable]。
*
* @since 4.4.0
* @see all
*/
public fun allToStreamable(): Streamable<Bot> =
all().asStreamable()

/**
* 得到所有 `id` 符合条件的 [Bot] 并转化为 [Streamable]。
*
* @since 4.4.0
* @see all
*/
public fun allToStreamable(id: ID): Streamable<Bot> =
all(id).asStreamable()

/**
* 将 [all] 收集为 [List] 并返回。
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ package love.forte.simbot.bot

import love.forte.simbot.common.collection.toImmutable
import love.forte.simbot.common.id.ID
import love.forte.simbot.common.streamable.Streamable
import love.forte.simbot.common.streamable.Streamable.Companion.asStreamable
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName

Expand All @@ -41,6 +43,13 @@ public interface BotManagers : Collection<BotManager> {
*/
public fun allBots(): Sequence<Bot> = asSequence().flatMap { it.all() }

/**
* 获取 [allBots] 的流转化器。
*
* @since 4.4.0
*/
public fun allBotsToStreamable(): Streamable<Bot> = allBots().asStreamable()

/**
* 尝试获取第一个 [BotManager] 中的第一个 [Bot]。
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Project https://github.com/simple-robot/simpler-robot
* Email ForteScarlet@163.com
*
* This file is part of the Simple Robot Library.
* This file is part of the Simple Robot Library (Alias: simple-robot, simbot, etc.).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -23,6 +23,9 @@

package love.forte.simbot.event

import love.forte.simbot.common.streamable.Streamable
import love.forte.simbot.common.streamable.Streamable.Companion.asStreamable


/**
* 事件监听器的“容器”接口,提供用于获取其中的所有 [EventListener] 的API。
Expand All @@ -37,5 +40,11 @@ public interface EventListenerContainer {
*/
public val listeners: Sequence<EventListener>


/**
* 获取到 [listeners] 并转化为 [Streamable]
*
* @see listeners
*/
public fun listenersToStreamable(): Streamable<EventListener> =
listeners.asStreamable()
}
1 change: 1 addition & 0 deletions simbot-api/src/jvmMain/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
requires simbot.logger;
requires static org.jetbrains.annotations;
requires static simbot.common.annotations;
requires simbot.common.streamable;
requires simbot.common.suspendrunner;
requires simbot.common.core;
requires simbot.common.collection;
Expand Down
Loading
Loading