diff --git a/.changelog/v3.3.0.0-beta.1.md b/.changelog/v3.3.0.0-beta.1.md new file mode 100644 index 00000000..86b1a452 --- /dev/null +++ b/.changelog/v3.3.0.0-beta.1.md @@ -0,0 +1,8 @@ +> 对应核心版本: [**v3.3.0**](https://github.com/simple-robot/simpler-robot/releases/tag/v3.3.0) + +> **Warning** +> 目前版本尚处于 **`BETA`** 阶段,代表仍然可能存在大量[已知问题](https://github.com/simple-robot/simbot-component-kook/issues)或未知问题, +以及未完善的内容和落后于官方更新的内容。** + +我们欢迎并期望着您的的[反馈](https://github.com/simple-robot/simbot-component-kook/issues)或[协助](https://github.com/simple-robot/simbot-component-kook/pulls), +感谢您的贡献与支持! diff --git a/CHANGELOG.md b/CHANGELOG.md index e66a7b94..07820bc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# v3.3.0.0-beta.1 + +> Release & Pull Notes: [v3.3.0.0-beta.1](https://github.com/simple-robot/simpler-robot/releases/tag/v3.3.0.0-beta.1) + +- fix: 消息发送中增加对 AtAll 的支持 ([`9363c9e`](https://github.com/simple-robot/simpler-robot/commit/9363c9e)) +- website: 配置域名 ([`bfc48ad`](https://github.com/simple-robot/simpler-robot/commit/bfc48ad)) +- fix(doc): 修复部分对配置文件 `ticket` 的描述错误问题 ([`3841f05`](https://github.com/simple-robot/simpler-robot/commit/3841f05)) +- CI: Qodana for branches 'main' ([`e813648`](https://github.com/simple-robot/simpler-robot/commit/e813648)) + # v3.2.0.0-alpha.8 > Release & Pull Notes: [v3.2.0.0-alpha.8](https://github.com/simple-robot/simpler-robot/releases/tag/v3.2.0.0-alpha.8) diff --git a/README.md b/README.md index 42cca5c1..c4927748 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ KOOK组件的**组件手册**: [组件手册][website] -> **Note** +> [!note] > 手册与simbot3官网均部署于GitHub Pages。 > 为了更好的浏览体验,**推荐**开启魔法后访问。 @@ -35,7 +35,7 @@ KOOK组件的**组件手册**: [组件手册][website]
简单示例 -> **Note** +> [!note] > Java开发者可直接参考 [组件手册][website] 中**快速开始**相关示例的Java部分代码。 > 使用 Kotlin + `simbot-component-kook-core` 配合 `simboot-core-spring-boot-starter` 使用 `Spring Boot` 的情况下: diff --git a/buildSrc/src/main/kotlin/P.kt b/buildSrc/src/main/kotlin/P.kt index 5e61cff5..19a26e81 100644 --- a/buildSrc/src/main/kotlin/P.kt +++ b/buildSrc/src/main/kotlin/P.kt @@ -39,7 +39,7 @@ import love.forte.gradle.common.core.project.version as v * */ -val simbotVersion = v(3, 2, 0) +val simbotVersion = v(3, 3, 0) val simbotApi = "love.forte.simbot:simbot-api:$simbotVersion" val simbotAnnotations = "love.forte.simbot.util:simbot-annotations:$simbotVersion" @@ -68,7 +68,7 @@ object P : ProjectDetail() { 0, 0 ) - private val alphaSuffix = v("alpha", 8) + private val alphaSuffix = v("beta", 1) override val version: Version = baseVersion - alphaSuffix diff --git a/buildSrc/src/main/kotlin/SuspendTransforms.kt b/buildSrc/src/main/kotlin/SuspendTransforms.kt index efef79a0..3fda6df7 100644 --- a/buildSrc/src/main/kotlin/SuspendTransforms.kt +++ b/buildSrc/src/main/kotlin/SuspendTransforms.kt @@ -37,7 +37,7 @@ object SuspendTransforms { */ val jvmAsyncTransformer = SuspendTransformConfiguration.jvmAsyncTransformer.copy( syntheticFunctionIncludeAnnotations = includeAnnotations, - transformFunctionInfo = FunctionInfo("love.forte.simbot.utils", null, "$\$runInAsync"), + transformFunctionInfo = FunctionInfo("love.forte.simbot.utils", null, "$\$runInAsyncNullable"), copyAnnotationExcludes = SuspendTransformConfiguration.jvmAsyncTransformer.copyAnnotationExcludes + SuspendTransformConfiguration.jvmAsyncTransformer.markAnnotation.classInfo ) diff --git a/buildSrc/src/main/kotlin/changelog/GenerateChangelog.kt b/buildSrc/src/main/kotlin/changelog/GenerateChangelog.kt index dfa7b8d4..16951a12 100644 --- a/buildSrc/src/main/kotlin/changelog/GenerateChangelog.kt +++ b/buildSrc/src/main/kotlin/changelog/GenerateChangelog.kt @@ -42,17 +42,19 @@ fun Project.generateChangelog(tag: String) { val coreVersion = simbotVersion - file.writeText(""" + file.writeText( + """ > 对应核心版本: [**v$coreVersion**](https://github.com/simple-robot/simpler-robot/releases/tag/v$coreVersion) - > **Warning** - > 目前版本尚处于 **`ALPHA`** 阶段,代表仍然可能存在大量[已知问题](https://github.com/simple-robot/simbot-component-kook/issues)或未知问题, + > [!warning] + > 目前版本尚处于 **`BETA`** 阶段,代表仍然可能存在部分[已知问题](https://github.com/simple-robot/simbot-component-kook/issues)或未知问题, 以及未完善的内容和落后于官方更新的内容。** 我们欢迎并期望着您的的[反馈](https://github.com/simple-robot/simbot-component-kook/issues)或[协助](https://github.com/simple-robot/simbot-component-kook/pulls), 感谢您的贡献与支持! - """.trimIndent()) + """.trimIndent() + ) } val rootChangelogFile = rootProject.file("CHANGELOG.md").also { file -> @@ -155,7 +157,7 @@ fun Project.generateChangelog(tag: String) { } } - val tmpDir = rootProject.buildDir.resolve("tmp/changelog").apply { mkdirs() } + val tmpDir = rootProject.layout.buildDirectory.dir("tmp/changelog").get().asFile val tmpFile = Files.createTempFile(tmpDir.toPath(), "changelog", "tmp").toFile() diff --git a/buildSrc/src/main/kotlin/kook-multiplatform-maven-publish.gradle.kts b/buildSrc/src/main/kotlin/kook-multiplatform-maven-publish.gradle.kts index 61937be3..793b2987 100644 --- a/buildSrc/src/main/kotlin/kook-multiplatform-maven-publish.gradle.kts +++ b/buildSrc/src/main/kotlin/kook-multiplatform-maven-publish.gradle.kts @@ -44,7 +44,6 @@ multiplatformConfigPublishing { project = P val jarJavadoc by tasks.registering(Jar::class) { - group = "documentation" archiveClassifier.set("javadoc") from(tasks.findByName("dokkaHtml")) } @@ -57,11 +56,12 @@ multiplatformConfigPublishing { if (systemProp("SIMBOT_LOCAL").toBoolean()) { mainHost = null } -// else { -// -// mainHostSupportedTargets = mainHost?.supports(hostManager) ?: emptySet() -// } +} +// TODO see https://github.com/gradle-nexus/publish-plugin/issues/208#issuecomment-1465029831 +val signingTasks: TaskCollection = tasks.withType() +tasks.withType().configureEach { + mustRunAfter(signingTasks) } fun KonanTarget.supports(hostManager: HostManager): Set { diff --git a/buildSrc/src/main/kotlin/simbot-kook-maven-publish.gradle.kts b/buildSrc/src/main/kotlin/simbot-kook-maven-publish.gradle.kts index ac83f345..ec6402c4 100644 --- a/buildSrc/src/main/kotlin/simbot-kook-maven-publish.gradle.kts +++ b/buildSrc/src/main/kotlin/simbot-kook-maven-publish.gradle.kts @@ -91,6 +91,11 @@ if (!isCi || isLinux) { } } +// TODO see https://github.com/gradle-nexus/publish-plugin/issues/208#issuecomment-1465029831 +val signingTasks: TaskCollection = tasks.withType() +tasks.withType().configureEach { + mustRunAfter(signingTasks) +} fun MavenPublication.show() { //// show project info diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6e26101d..c48aa985 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ forte-di = "0.0.3" forte-annotationTool = "0.6.3" ktor = "2.3.0" log4j = "2.20.0" -atomicfu = "0.20.1" +atomicfu = "0.23.1" [libraries] # jetbrains-annotation diff --git a/simbot-component-kook-api/README.md b/simbot-component-kook-api/README.md index fd9f5946..fdaa6f7d 100644 --- a/simbot-component-kook-api/README.md +++ b/simbot-component-kook-api/README.md @@ -1,9 +1,9 @@ # simple-component-kook-api -> **Note** +> [!note] > 请先阅读 [模块说明](Module.md) -> **Note** +> [!note] > 更详细的快速开始建议前往阅读 [组件手册](https://component-kook.simbot.forte.love/docs/quick-start/api) 中的相关章节。 diff --git a/simbot-component-kook-api/build.gradle.kts b/simbot-component-kook-api/build.gradle.kts index aa82d16b..de0659f2 100644 --- a/simbot-component-kook-api/build.gradle.kts +++ b/simbot-component-kook-api/build.gradle.kts @@ -16,7 +16,6 @@ */ import love.forte.gradle.common.core.project.setup -import love.forte.gradle.common.kotlin.multiplatform.NativeTargets plugins { kotlin("multiplatform") @@ -42,6 +41,7 @@ repositories { kotlin { explicitApi() + applyDefaultHierarchyTemplate() sourceSets.configureEach { languageSettings { @@ -69,85 +69,34 @@ kotlin { } - val mainPresets = mutableSetOf() - val testPresets = mutableSetOf() - - // see https://kotlinlang.org/docs/native-target-supporsupportTargets = setOf( - //// // Tier 1 - //// "linuxX64", - //// "macosX64", - //// "macosArm64", - //// "iosSimulatorArm64", - //// "iosX64", - //// - //// // Tier 2 - ////// "linuxArm64", - //// "watchosSimulatorArm64", - //// "watchosX64", - //// "watchosArm32", - //// "watchosArm64", - //// "tvosSimulatorArm64", - //// "tvosX64", - //// "tvosArm64", - //// "iosArm64", - //// - //// // Tier 3 - ////// "androidNativeArm32", - ////// "androidNativeArm64", - ////// "androidNativeX86", - ////// "androidNativeX64", - //// "mingwX64", - ////// "watchosDeviceArm64", - //// )t.html -// val - - val targets = NativeTargets.Official.all.intersect(NativeTargets.KtorClient.all) - - - targets { - presets.filterIsInstance>() - .filter { it.name in targets } - .forEach { presets -> - val target = fromPreset(presets, presets.name) - val mainSourceSet = target.compilations["main"].kotlinSourceSets.first() - val testSourceSet = target.compilations["test"].kotlinSourceSets.first() - - val tn = target.name - when { - // just for test - // main中只使用HttpClient但用不到引擎,没必要指定 - - // win - tn.startsWith("mingw") -> { - testSourceSet.dependencies { - implementation(libs.ktor.client.winhttp) - } - } - // linux: CIO..? - tn.startsWith("linux") -> { - testSourceSet.dependencies { - implementation(libs.ktor.client.cio) - } - } - - // darwin based - tn.startsWith("macos") - || tn.startsWith("ios") - || tn.startsWith("watchos") - || tn.startsWith("tvos") -> { - testSourceSet.dependencies { - implementation(libs.ktor.client.darwin) - } - } - } - - mainPresets.add(mainSourceSet) - testPresets.add(testSourceSet) - } - } + // Tier 1 + macosX64() + macosArm64() + iosSimulatorArm64() + iosX64() + + // Tier 2 + linuxX64() + linuxArm64() + watchosSimulatorArm64() + watchosX64() + watchosArm32() + watchosArm64() + tvosSimulatorArm64() + tvosX64() + tvosArm64() + iosArm64() + + // Tier 3 +// androidNativeArm32() +// androidNativeArm64() +// androidNativeX86() +// androidNativeX64() + mingwX64() +// watchosDeviceArm64() sourceSets { - val commonMain by getting { + commonMain { dependencies { compileOnly(simbotAnnotations) api(simbotRequestorCore) @@ -159,21 +108,21 @@ kotlin { } } - val commonTest by getting { + commonTest { dependencies { implementation(kotlin("test")) implementation(libs.kotlinx.coroutines.test) } } - getByName("jvmMain") { + jvmMain { dependencies { compileOnly(simbotApi) // use @Api4J annotation compileOnly(simbotAnnotations) // use @Api4J annotation } } - getByName("jvmTest") { + jvmTest { dependencies { implementation(libs.ktor.client.cio) implementation(simbotApi) // use @Api4J annotation @@ -183,28 +132,16 @@ kotlin { } } - getByName("jsMain") { + jsMain { dependencies { api(libs.ktor.client.js) } } - getByName("jsTest") { + jsTest { dependencies { api(libs.ktor.client.js) } } - - val nativeMain by creating { - dependsOn(commonMain) - } - - val nativeTest by creating { - dependsOn(commonTest) - } - - configure(mainPresets) { dependsOn(nativeMain) } - configure(testPresets) { dependsOn(nativeTest) } - } } diff --git a/simbot-component-kook-api/src/commonMain/kotlin/love/forte/simbot/kook/api/KookApi.kt b/simbot-component-kook-api/src/commonMain/kotlin/love/forte/simbot/kook/api/KookApi.kt index 5c05758c..dad1414e 100644 --- a/simbot-component-kook-api/src/commonMain/kotlin/love/forte/simbot/kook/api/KookApi.kt +++ b/simbot-component-kook-api/src/commonMain/kotlin/love/forte/simbot/kook/api/KookApi.kt @@ -40,7 +40,6 @@ import kotlin.coroutines.CoroutineContext import kotlin.coroutines.coroutineContext import kotlin.jvm.JvmField import kotlin.jvm.JvmSynthetic -import kotlin.jvm.Volatile /** * 面向平台实现的 [KookApi] 的抽象类。 @@ -429,7 +428,7 @@ public abstract class KookPostApi : BaseKookApi() { override val method: HttpMethod get() = HttpMethod.Post - @Volatile + @kotlin.concurrent.Volatile private lateinit var _body: Any /** diff --git a/simbot-component-kook-stdlib/build.gradle.kts b/simbot-component-kook-stdlib/build.gradle.kts index 0a84b330..e7f3e45e 100644 --- a/simbot-component-kook-stdlib/build.gradle.kts +++ b/simbot-component-kook-stdlib/build.gradle.kts @@ -16,7 +16,6 @@ */ import love.forte.gradle.common.core.project.setup -import love.forte.gradle.common.kotlin.multiplatform.NativeTargets plugins { kotlin("multiplatform") @@ -44,6 +43,7 @@ repositories { kotlin { explicitApi() + applyDefaultHierarchyTemplate() sourceSets.configureEach { languageSettings { @@ -70,119 +70,64 @@ kotlin { nodejs() } - - val mainPresets = mutableSetOf() - val testPresets = mutableSetOf() - - // see https://kotlinlang.org/docs/native-target-suppors - - val targets = NativeTargets.Official.all.intersect(NativeTargets.KtorClient.all) - - targets { - presets.filterIsInstance>() - .filter { it.name in targets } - .forEach { presets -> - val target = fromPreset(presets, presets.name) - val mainSourceSet = target.compilations["main"].kotlinSourceSets.first() - val testSourceSet = target.compilations["test"].kotlinSourceSets.first() - - val tn = target.name - when { - // just for test - // main中只使用HttpClient但用不到引擎,没必要指定 - - // win - tn.startsWith("mingw") -> { - testSourceSet.dependencies { - implementation(libs.ktor.client.winhttp) - } - } - // linux: CIO..? - tn.startsWith("linux") -> { - testSourceSet.dependencies { - implementation(libs.ktor.client.cio) - } - } - - // darwin based - tn.startsWith("macos") - || tn.startsWith("ios") - || tn.startsWith("watchos") - || tn.startsWith("tvos") -> { - testSourceSet.dependencies { - implementation(libs.ktor.client.darwin) - } - } - } - - mainPresets.add(mainSourceSet) - testPresets.add(testSourceSet) - } - } + // Tier 1 + macosX64() + macosArm64() + iosSimulatorArm64() + iosX64() + + // Tier 2 + linuxX64() + linuxArm64() + watchosSimulatorArm64() + watchosX64() + watchosArm32() + watchosArm64() + tvosSimulatorArm64() + tvosX64() + tvosArm64() + iosArm64() + + // Tier 3 +// androidNativeArm32() +// androidNativeArm64() +// androidNativeX86() +// androidNativeX64() + mingwX64() +// watchosDeviceArm64() sourceSets { - val commonMain by getting { - dependencies { - api(project(":simbot-component-kook-api")) - api(simbotLogger) - api(simbotUtilLoop) - api(simbotUtilSuspendTransformer) - compileOnly(simbotUtilAnnotations) - api(libs.kotlinx.coroutines.core) - api(libs.ktor.client.ws) - api("org.jetbrains.kotlinx:atomicfu:${libs.versions.atomicfu.get()}") - } + commonMain.dependencies { + api(project(":simbot-component-kook-api")) + api(simbotLogger) + api(simbotUtilLoop) + api(simbotUtilSuspendTransformer) + compileOnly(simbotUtilAnnotations) + api(libs.kotlinx.coroutines.core) + api(libs.ktor.client.ws) + api("org.jetbrains.kotlinx:atomicfu:${libs.versions.atomicfu.get()}") } - val commonTest by getting { - dependencies { - implementation(kotlin("test")) - implementation(libs.kotlinx.coroutines.test) - } + commonTest.dependencies { + implementation(kotlin("test")) + implementation(libs.kotlinx.coroutines.test) } - val jvmMain by getting { - dependencies { - compileOnly(simbotUtilAnnotations) // use @Api4J annotation - } + jvmMain.dependencies { + compileOnly(simbotUtilAnnotations) // use @Api4J annotation } -// getByName("jvmMain") { -// dependencies { -// compileOnly(simbotUtilAnnotations) // use @Api4J annotation -// api(project(":simbot-component-kook-api-multi")) -// } -// } - - getByName("jvmTest") { - dependencies { - implementation(libs.ktor.client.cio) - implementation(simbotApi) - implementation(simbotLogger) - implementation(simbotLoggerSlf4j) -// implementation(libs.log4j.api) -// implementation(libs.log4j.core) -// implementation(libs.log4j.slf4j2Impl) - } - } - - getByName("jsMain") { - dependencies { - implementation(libs.ktor.client.js) - } + jvmTest.dependencies { + implementation(libs.ktor.client.cio) + implementation(simbotApi) + implementation(simbotLogger) + implementation(simbotLoggerSlf4j) } - val nativeMain by creating { - dependsOn(commonMain) + jsMain.dependencies { + implementation(libs.ktor.client.js) } - val nativeTest by creating { - dependsOn(commonTest) - } - - configure(mainPresets) { dependsOn(nativeMain) } - configure(testPresets) { dependsOn(nativeTest) } - } } diff --git a/simbot-component-kook-stdlib/src/commonMain/kotlin/love/forte/simbot/kook/internal/BotImpl.kt b/simbot-component-kook-stdlib/src/commonMain/kotlin/love/forte/simbot/kook/internal/BotImpl.kt index f3779c21..6554462d 100644 --- a/simbot-component-kook-stdlib/src/commonMain/kotlin/love/forte/simbot/kook/internal/BotImpl.kt +++ b/simbot-component-kook-stdlib/src/commonMain/kotlin/love/forte/simbot/kook/internal/BotImpl.kt @@ -43,7 +43,6 @@ import love.forte.simbot.kook.event.Signal import love.forte.simbot.logger.LoggerFactory import love.forte.simbot.util.stageloop.loop import kotlin.coroutines.CoroutineContext -import kotlin.jvm.Volatile internal typealias EventProcessor = suspend Event<*>.(raw: String) -> Unit @@ -184,7 +183,7 @@ internal class BotImpl( override var isStarted: Boolean by atomic(false) - @Volatile + @kotlin.concurrent.Volatile private lateinit var _me: Me override suspend fun me(): Me { @@ -202,7 +201,7 @@ internal class BotImpl( private val startLock = Mutex() - @Volatile + @kotlin.concurrent.Volatile private var currentClientJob: Job? = null override suspend fun start(closeBotOnFailure: Boolean) { diff --git a/support-list.md b/support-list.md index 269264f9..74596bd5 100644 --- a/support-list.md +++ b/support-list.md @@ -1,6 +1,6 @@ # 功能支持清单 -> **Note** +> [!note] > 清单尚未支持的功能可能会在未来的版本更新中逐步支持,也可能会因为反馈较少而被遗忘。 > 如果你需要一个尚未支持的 KOOK API(也包括后续官方更新而不存在于此清单中的功能), > 欢迎提交 [issues](https://github.com/simple-robot/simpler-robot/issues/new/choose) 来让我们知道!