Skip to content

Commit b84992b

Browse files
authored
Merge pull request #235 from simple-robot/dev/main
Release: v4.1.0
2 parents 3ea12ce + 9a763a3 commit b84992b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+8506
-397
lines changed

.changelog/v4.1.0.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
| 依赖 | 版本 |
2+
| ---: | :--- |
3+
| Kotlin | **v2.1.20** |
4+
| simbot核心库 | [**v4.12.0**](https://github.com/simple-robot/simpler-robot/releases/tag/v4.12.0) |
5+
6+
我们欢迎并期望着您的 [反馈](https://github.com/simple-robot/simbot-component-kook/issues)[协助](https://github.com/simple-robot/simbot-component-kook/pulls),感谢您的贡献与支持!

.github/workflows/publish-kdoc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
env:
77
JAVA_VERSION: 21
88
JAVA_DISTRIBUTION: zulu
9-
GRADLE_VERSION: 8.5
9+
GRADLE_VERSION: 8.10.2
1010
IS_CI: true
1111
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
1212
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
@@ -45,7 +45,7 @@ jobs:
4545
--warning-mode all
4646
-x test
4747
--build-cache
48-
dokkaHtmlMultiModule
48+
dokkaGenerate
4949
5050
- name: Push to doc repository
5151
uses: peaceiris/actions-gh-pages@v3

.github/workflows/publish-release.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ concurrency:
1111
env:
1212
JAVA_VERSION: 21
1313
JAVA_DISTRIBUTION: zulu
14-
GRADLE_VERSION: 8.5
14+
GRADLE_VERSION: 8.10.2
1515
IS_CI: true
1616
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
1717
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
@@ -40,17 +40,22 @@ jobs:
4040
uses: gradle/actions/setup-gradle@v3
4141
with:
4242
gradle-version: ${{ env.GRADLE_VERSION }}
43+
arguments: |
44+
assemble
45+
allTests
46+
--stacktrace
47+
--warning-mode all
48+
-Pkotlin.native.enableKlibsCrossCompilation=false
4349
44-
- name: Run all tests
45-
run: gradle assemble allTests --stacktrace --warning-mode all
46-
50+
# - name: Run all tests
51+
# run: gradle assemble allTests --stacktrace --warning-mode all -Pkotlin.native.enableKlibsCrossCompilation=false
4752

4853
publish-releases:
4954
name: Publish releases
5055
needs: run-test
5156
# 交叉编译 support
5257
# see https://kotlinlang.org/docs/multiplatform-publish-lib.html#host-requirements
53-
runs-on: macos-latest
58+
runs-on: ubuntu-latest
5459
steps:
5560
- uses: actions/checkout@v4
5661
- uses: actions/setup-java@v4
@@ -126,7 +131,7 @@ jobs:
126131
--warning-mode all
127132
-x test
128133
--build-cache
129-
dokkaHtmlMultiModule
134+
dokkaGenerate
130135
131136
- name: Push to doc repository
132137
uses: peaceiris/actions-gh-pages@v3

.github/workflows/publish-snapshot.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222
env:
2323
JAVA_VERSION: 21
2424
JAVA_DISTRIBUTION: zulu
25-
GRADLE_VERSION: 8.5
25+
GRADLE_VERSION: 8.10.2
2626
IS_CI: true
2727
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
2828
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
@@ -53,14 +53,20 @@ jobs:
5353
uses: gradle/actions/setup-gradle@v3
5454
with:
5555
gradle-version: ${{ env.GRADLE_VERSION }}
56+
arguments: |
57+
assemble
58+
allTests
59+
--stacktrace
60+
--warning-mode all
61+
-Pkotlin.native.enableKlibsCrossCompilation=false
5662
57-
- name: Gradle run all tests
58-
run: gradle assemble allTests --stacktrace --warning-mode all
63+
# - name: Gradle run all tests
64+
# run: gradle assemble allTests --stacktrace --warning-mode all -Pkotlin.native.enableKlibsCrossCompilation=false
5965

6066
publish-snapshots:
6167
name: Publish snapshots
6268
needs: run-test
63-
runs-on: macos-latest
69+
runs-on: ubuntu-latest
6470
steps:
6571
- uses: actions/checkout@v4
6672
- uses: actions/setup-java@v4
@@ -113,7 +119,7 @@ jobs:
113119
--warning-mode all
114120
-x test
115121
--build-cache
116-
dokkaHtmlMultiModule
122+
dokkaGenerate
117123
118124
- name: Push to doc repository
119125
uses: peaceiris/actions-gh-pages@v3

.github/workflows/qodana_code_quality.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Qodana
22
on:
33
workflow_dispatch:
4-
pull_request:
4+
pull_request_target:
55
branches:
66
- dev/main
77
- main

CHANGELOG.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
# v4.0.2
1+
# v4.1.0
22

3-
> Release & Pull Notes: [v4.0.2](https://github.com/simple-robot/simpler-robot/releases/tag/v4.0.2)
3+
> Release & Pull Notes: [v4.1.0](https://github.com/simple-robot/simpler-robot/releases/tag/v4.1.0)
44
5-
- fix(core): 修复事件中接收的 MessageContent 中, `referenceMessage` 的行为与 `reference` 不一致,会错误地获取自身消息详情而非引用消息详情的问题 ([`517e442`](https://github.com/simple-robot/simpler-robot/commit/517e442))
5+
- build(deps): bump org.jetbrains:annotations from 26.0.1 to 26.0.2 ([`5297dda`](https://github.com/simple-robot/simpler-robot/commit/5297dda))
6+
- build(deps): bump log4j from 2.24.2 to 2.24.3 ([`f95ba57`](https://github.com/simple-robot/simpler-robot/commit/f95ba57))
7+
- build(deps): bump log4j from 2.24.1 to 2.24.2 ([`56644dd`](https://github.com/simple-robot/simpler-robot/commit/56644dd))
8+
- build(deps): bump com.squareup:kotlinpoet-ksp from 1.18.1 to 2.0.0 ([`5cbce0a`](https://github.com/simple-robot/simpler-robot/commit/5cbce0a))
9+
- build(deps): bump org.jetbrains:annotations from 24.1.0 to 26.0.1 ([`ba3948a`](https://github.com/simple-robot/simpler-robot/commit/ba3948a))
10+
- build(deps): bump log4j from 2.23.0 to 2.24.1 ([`8e19f2c`](https://github.com/simple-robot/simpler-robot/commit/8e19f2c))
11+
- build: 调整Opt注解的依赖传播方式 ([`134ea59`](https://github.com/simple-robot/simpler-robot/commit/134ea59))
12+
- optimize(core): 隐藏部分未隐藏的挂起函数 ([`cccc2b0`](https://github.com/simple-robot/simpler-robot/commit/cccc2b0))
613

7-
# v4.0.1
814

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

build.gradle.kts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ plugins {
2121
`simbot-kook-changelog-generator`
2222
`simbot-kook-dokka-multi-module`
2323
`simbot-kook-nexus-publish`
24+
alias(libs.plugins.kotlinxBinaryCompatibilityValidator)
2425
}
2526

2627
buildscript {
@@ -40,3 +41,26 @@ allprojects {
4041
}
4142
}
4243
}
44+
45+
apiValidation {
46+
ignoredPackages.add("*.internal.*")
47+
48+
ignoredProjects.addAll(
49+
listOf(
50+
"api-reader",
51+
"message-element-processor"
52+
),
53+
)
54+
55+
// 实验性和内部API可能无法保证二进制兼容
56+
nonPublicMarkers.addAll(
57+
listOf(
58+
"love.forte.simbot.annotations.ExperimentalSimbotAPI",
59+
"love.forte.simbot.annotations.InternalSimbotAPI",
60+
"love.forte.simbot.kook.ExperimentalKookApi",
61+
"love.forte.simbot.kook.InternalKookApi",
62+
),
63+
)
64+
65+
apiDumpDirectory = "api"
66+
}

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ val kotlinVersion: String = libs.versions.kotlin.get()
3333
dependencies {
3434
implementation(kotlin("gradle-plugin", kotlinVersion))
3535
implementation(kotlin("serialization", kotlinVersion))
36-
implementation(libs.bundles.dokka)
36+
implementation(libs.dokka.plugin)
3737

3838
// see https://github.com/gradle-nexus/publish-plugin
3939
implementation("io.github.gradle-nexus:publish-plugin:2.0.0")
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
import org.gradle.api.Project
2+
import org.gradle.api.tasks.compile.JavaCompile
3+
import org.jetbrains.dokka.gradle.DokkaExtension
4+
import org.jetbrains.dokka.gradle.engine.parameters.DokkaSourceSetSpec
5+
import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier
6+
import org.jetbrains.dokka.gradle.engine.plugins.DokkaHtmlPluginParameters
7+
import java.io.File
8+
import java.net.URI
9+
import java.time.Year
10+
11+
/*
12+
* Copyright (c) 2025. ForteScarlet.
13+
*
14+
* This file is part of simbot-component-onebot.
15+
*
16+
* simbot-component-onebot is free software: you can redistribute it and/or modify it under the terms
17+
* of the GNU Lesser General Public License as published by the Free Software Foundation,
18+
* either version 3 of the License, or (at your option) any later version.
19+
*
20+
* simbot-component-onebot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
21+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22+
* See the GNU Lesser General Public License for more details.
23+
*
24+
* You should have received a copy of the GNU Lesser General Public License along with simbot-component-onebot.
25+
* If not, see <https://www.gnu.org/licenses/>.
26+
*/
27+
28+
fun DokkaExtension.configSourceSets(project: Project) {
29+
dokkaSourceSets.configureEach {
30+
skipEmptyPackages.set(true)
31+
suppressGeneratedFiles.set(false)
32+
documentedVisibilities(
33+
VisibilityModifier.Public,
34+
VisibilityModifier.Protected
35+
)
36+
project.tasks.withType(JavaCompile::class.java).firstOrNull()
37+
?.targetCompatibility?.toInt().also {
38+
logger.info("project {} found jdkVersionValue: {}", project, it)
39+
}?.also {
40+
jdkVersion.set(it)
41+
}
42+
43+
configModuleMdInclude(project)
44+
45+
perPackageOption {
46+
matchingRegex.set(".*internal.*") // will match all .internal packages and sub-packages
47+
suppress.set(true)
48+
}
49+
50+
configSourceLink(project)
51+
52+
configExternalDocumentations()
53+
}
54+
}
55+
56+
fun DokkaSourceSetSpec.configModuleMdInclude(project: Project) {
57+
val moduleFile = project.file("Module.md")
58+
if (moduleFile.exists() && moduleFile.length() > 0) {
59+
includes.from("Module.md")
60+
}
61+
}
62+
63+
fun DokkaSourceSetSpec.configSourceLink(project: Project) {
64+
sourceLink {
65+
localDirectory.set(File(project.projectDir, "src"))
66+
val relativeTo = project.projectDir.relativeTo(project.rootProject.projectDir).toString()
67+
.replace('\\', '/')
68+
remoteUrl.set(URI.create("${P.HOMEPAGE}/tree/dev/main/$relativeTo/src"))
69+
remoteLineSuffix.set("#L")
70+
}
71+
}
72+
73+
fun DokkaSourceSetSpec.configExternalDocumentations() {
74+
fun externalDocumentation(name: String, docUrl: URI, suffix: String = "package-list") {
75+
externalDocumentationLinks.register(name) {
76+
url.set(docUrl)
77+
packageListUrl.set(docUrl.resolve(suffix))
78+
}
79+
}
80+
81+
// kotlin-coroutines doc
82+
externalDocumentation(
83+
"kotlinx.coroutines",
84+
URI.create("https://kotlinlang.org/api/kotlinx.coroutines/")
85+
)
86+
87+
// kotlin-serialization doc
88+
externalDocumentation(
89+
"kotlinx.serialization",
90+
URI.create("https://kotlinlang.org/api/kotlinx.serialization/")
91+
)
92+
93+
// ktor
94+
externalDocumentation(
95+
"ktor",
96+
URI.create("https://api.ktor.io/")
97+
)
98+
99+
// SLF4J
100+
externalDocumentation(
101+
"slf4j",
102+
URI.create("https://www.slf4j.org/apidocs/"),
103+
"element-list"
104+
)
105+
}
106+
107+
fun DokkaHtmlPluginParameters.configHtmlCustoms(project: Project) {
108+
customAssets.from(
109+
project.rootProject.file(".simbot/dokka-assets/logo-icon.svg"),
110+
project.rootProject.file(".simbot/dokka-assets/logo-icon-light.svg"),
111+
)
112+
113+
customStyleSheets.from(project.rootProject.file(".simbot/dokka-assets/css/kdoc-style.css"))
114+
115+
if (!isSimbotLocal()) {
116+
templatesDir.set(project.rootProject.file(".simbot/dokka-templates"))
117+
}
118+
119+
val now = Year.now().value
120+
footerMessage.set(
121+
"© 2024-$now " +
122+
"<a href='https://github.com/simple-robot'>Simple Robot</a>. All rights reserved."
123+
)
124+
125+
separateInheritedMembers.set(true)
126+
mergeImplicitExpectActualDeclarations.set(true)
127+
homepageLink.set(P.HOMEPAGE)
128+
}

buildSrc/src/main/kotlin/JsConfig.kt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,10 @@ inline fun KotlinJsTargetDsl.configJs(
2626
) {
2727
if (nodeJs) {
2828
nodejs()
29-
// {
30-
//// testTask {
31-
//// useMocha {
32-
//// timeout = "10000"
33-
//// }
34-
//// }
35-
// }
3629
}
3730

3831
if (browser) {
3932
browser()
40-
// {
41-
// testTask{
42-
// useKarma {
43-
// useChromeHeadless()
44-
// // useConfigDirectory(File(project.rootProject.projectDir, "karma"))
45-
// }
46-
// }
47-
// }
4833
}
4934

5035
binaries.library()

buildSrc/src/main/kotlin/JvmConfig.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@ import org.gradle.kotlin.dsl.withType
2828
import org.gradle.process.CommandLineArgumentProvider
2929
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
3030
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
31+
import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension
3132
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
3233
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
33-
import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension
3434
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
3535

3636

3737
@OptIn(ExperimentalKotlinGradlePluginApi::class)
3838
inline fun KotlinJvmTarget.configJava(crossinline block: KotlinJvmTarget.() -> Unit = {}) {
39-
withJava()
4039
compilerOptions {
4140
javaParameters = true
4241
freeCompilerArgs.addAll(
@@ -51,7 +50,7 @@ inline fun KotlinJvmTarget.configJava(crossinline block: KotlinJvmTarget.() -> U
5150
}
5251

5352

54-
fun KotlinTopLevelExtension.configJavaToolchain(jdkVersion: Int) {
53+
fun KotlinBaseExtension.configJavaToolchain(jdkVersion: Int) {
5554
jvmToolchain(jdkVersion)
5655
}
5756

@@ -91,8 +90,13 @@ inline fun Project.configJavaCompileWithModule(
9190

9291
if (moduleName != null) {
9392
options.compilerArgumentProviders.add(CommandLineArgumentProvider {
94-
// Provide compiled Kotlin classes to javac – needed for Java/Kotlin mixed sources to work
95-
listOf("--patch-module", "$moduleName=${sourceSets["main"].output.asPath}")
93+
val sourceSet = sourceSets.findByName("main") ?: sourceSets.findByName("jvmMain")
94+
if (sourceSet != null) {
95+
// Provide compiled Kotlin classes to javac – needed for Java/Kotlin mixed sources to work
96+
listOf("--patch-module", "$moduleName=${sourceSet.output.asPath}")
97+
} else {
98+
emptyList()
99+
}
96100
})
97101
}
98102

buildSrc/src/main/kotlin/P.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ object P : ProjectDetail() {
3232
override val homepage: String
3333
get() = HOMEPAGE
3434

35-
const val VERSION = "4.0.2"
36-
const val NEXT_VERSION = "4.0.3"
35+
const val VERSION = "4.1.0"
36+
const val NEXT_VERSION = "4.1.1"
3737

3838
override val snapshotVersion = "$NEXT_VERSION-SNAPSHOT"
3939
override val version = if (isSnapshot()) snapshotVersion else VERSION

0 commit comments

Comments
 (0)