Skip to content

Commit 19a1b05

Browse files
committed
feat: Add experimental Wasm JS interop annotations and new API definitions
Signed-off-by: ForteScarlet <ForteScarlet@163.com>
1 parent 502a28a commit 19a1b05

File tree

35 files changed

+4274
-217
lines changed

35 files changed

+4274
-217
lines changed

.idea/copyright/simbot.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle.kts

Lines changed: 59 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,24 @@
2424
import changelog.GenerateChangelogTask
2525
import changelog.GenerateSubChangelogTask
2626
import love.forte.plugin.suspendtrans.gradle.SuspendTransformPluginExtension
27+
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
28+
import org.jetbrains.kotlin.gradle.dsl.abi.AbiValidationExtension
29+
import org.jetbrains.kotlin.gradle.dsl.abi.AbiValidationMultiplatformExtension
30+
import org.jetbrains.kotlin.gradle.dsl.abi.ExperimentalAbiValidation
2731

2832
plugins {
2933
idea
3034
id("org.jetbrains.dokka")
31-
// id("simbot.dokka-multi-module")
3235
id("com.github.gmazzo.buildconfig") version "5.6.7" apply false
3336
kotlin("multiplatform") apply false
3437
kotlin("jvm") apply false
3538
alias(libs.plugins.ksp) apply false
3639
alias(libs.plugins.detekt)
37-
id("simbot.nexus-publish")
3840
id("love.forte.plugin.suspend-transform") apply false
39-
// alias(libs.plugins.suspendTransform) apply false
4041

4142
// https://www.jetbrains.com/help/qodana/code-coverage.html
4243
// https://github.com/Kotlin/kotlinx-kover
4344
alias(libs.plugins.kotlinxKover)
44-
45-
alias(libs.plugins.kotlinxBinaryCompatibilityValidator)
46-
47-
4845
}
4946

5047
setupGroup(P.Simbot)
@@ -60,7 +57,7 @@ repositories {
6057
}
6158
}
6259
}
63-
mavenLocal()
60+
// mavenLocal()
6461
}
6562

6663
val root = project
@@ -81,7 +78,7 @@ subprojects {
8178
}
8279
}
8380
}
84-
mavenLocal()
81+
// mavenLocal()
8582
}
8683

8784
afterEvaluate {
@@ -90,6 +87,8 @@ subprojects {
9087
if (plugins.hasPlugin(libs.plugins.suspendTransform.get().pluginId)) {
9188
configureSuspendTransform()
9289
}
90+
91+
configKotlinAbiValidation()
9392
}
9493
}
9594

@@ -150,36 +149,59 @@ fun Project.applyKover(rp: Project) {
150149
}
151150
//endregion
152151

153-
apiValidation {
154-
ignoredPackages.add("*.internal.*")
155-
156-
ignoredProjects.addAll(
157-
listOf(
158-
"interface-uml-processor",
159-
"simbot-test",
160-
"tests",
161-
"spring-boot-starter-test",
162-
"simbot-processor-class-builder-test"
163-
)
164-
)
165-
166-
// 实验性和内部API可能无法保证二进制兼容
167-
nonPublicMarkers.addAll(
168-
listOf(
169-
"love.forte.simbot.annotations.ExperimentalSimbotAPI",
170-
"love.forte.simbot.annotations.InternalSimbotAPI",
171-
"love.forte.simbot.resource.ExperimentalIOResourceAPI",
172-
"love.forte.simbot.extension.continuous.session.ExperimentalContinuousSessionAPI"
173-
),
174-
)
175-
176-
ignoredClasses.add("love.forte.simbot.suspendrunner.SuspendMarker")
177-
ignoredClasses.add("love.forte.simbot.suspendrunner.SuspendMarker.Container")
178-
ignoredClasses.add("love.forte.simbot.suspendrunner.SuspendMarker\$Container")
179-
180-
apiDumpDirectory = "api"
152+
@OptIn(ExperimentalAbiValidation::class)
153+
fun Project.configKotlinAbiValidation() {
154+
when {
155+
plugins.hasPlugin("org.jetbrains.kotlin.jvm") -> {
156+
extensions.configure<KotlinJvmProjectExtension>("kotlin") {
157+
extensions.configure<AbiValidationExtension>("abiValidation") {
158+
enabled.convention(true)
159+
configAbiValidation()
160+
}
161+
}
162+
}
163+
164+
plugins.hasPlugin("org.jetbrains.kotlin.multiplatform") -> {
165+
extensions.configure<org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension> {
166+
extensions.configure<AbiValidationMultiplatformExtension>("abiValidation") {
167+
enabled.convention(true)
168+
configAbiValidation()
169+
}
170+
}
171+
}
172+
}
181173
}
182174

175+
// apiValidation {
176+
// ignoredPackages.add("*.internal.*")
177+
//
178+
// ignoredProjects.addAll(
179+
// listOf(
180+
// "interface-uml-processor",
181+
// "simbot-test",
182+
// "tests",
183+
// "spring-boot-starter-test",
184+
// "simbot-processor-class-builder-test"
185+
// )
186+
// )
187+
//
188+
// // 实验性和内部API可能无法保证二进制兼容
189+
// nonPublicMarkers.addAll(
190+
// listOf(
191+
// "love.forte.simbot.annotations.ExperimentalSimbotAPI",
192+
// "love.forte.simbot.annotations.InternalSimbotAPI",
193+
// "love.forte.simbot.resource.ExperimentalIOResourceAPI",
194+
// "love.forte.simbot.extension.continuous.session.ExperimentalContinuousSessionAPI"
195+
// ),
196+
// )
197+
//
198+
// ignoredClasses.add("love.forte.simbot.suspendrunner.SuspendMarker")
199+
// ignoredClasses.add("love.forte.simbot.suspendrunner.SuspendMarker.Container")
200+
// ignoredClasses.add("love.forte.simbot.suspendrunner.SuspendMarker\$Container")
201+
//
202+
// apiDumpDirectory = "api"
203+
// }
204+
183205
idea {
184206
module {
185207
isDownloadSources = true

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ plugins {
2929
repositories {
3030
mavenCentral()
3131
gradlePluginPortal()
32-
mavenLocal()
32+
// mavenLocal()
3333
}
3434

3535
val kotlinVersion: String = libs.versions.kotlin.get()
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2025. ForteScarlet.
3+
*
4+
* Project https://github.com/simple-robot/simpler-robot
5+
* Email ForteScarlet@163.com
6+
*
7+
* This file is part of the Simple Robot Library (Alias: simple-robot, simbot, etc.).
8+
*
9+
* This program is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU Lesser General Public License as published by
11+
* the Free Software Foundation, either version 3 of the License, or
12+
* (at your option) any later version.
13+
*
14+
* This program is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* Lesser GNU General Public License for more details.
18+
*
19+
* You should have received a copy of the Lesser GNU General Public License
20+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
21+
*
22+
*/
23+
24+
import org.jetbrains.kotlin.gradle.dsl.abi.AbiValidationVariantSpec
25+
import org.jetbrains.kotlin.gradle.dsl.abi.ExperimentalAbiValidation
26+
27+
@ExperimentalAbiValidation
28+
fun AbiValidationVariantSpec.configAbiValidation() {
29+
filters.excluded.byNames.add("**.internal.**")
30+
31+
filters.excluded.annotatedWith.addAll(
32+
"love.forte.simbot.annotations.ExperimentalSimbotAPI",
33+
"love.forte.simbot.annotations.InternalSimbotAPI",
34+
"love.forte.simbot.resource.ExperimentalIOResourceAPI",
35+
"love.forte.simbot.extension.continuous.session.ExperimentalContinuousSessionAPI"
36+
)
37+
}

internal-processors/interface-uml-processor/build.gradle.kts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
/*
2+
* Copyright (c) 2025. ForteScarlet.
3+
*
4+
* Project https://github.com/simple-robot/simpler-robot
5+
* Email ForteScarlet@163.com
6+
*
7+
* This file is part of the Simple Robot Library (Alias: simple-robot, simbot, etc.).
8+
*
9+
* This program is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU Lesser General Public License as published by
11+
* the Free Software Foundation, either version 3 of the License, or
12+
* (at your option) any later version.
13+
*
14+
* This program is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* Lesser GNU General Public License for more details.
18+
*
19+
* You should have received a copy of the Lesser GNU General Public License
20+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
21+
*
22+
*/
23+
24+
import org.jetbrains.kotlin.gradle.dsl.abi.ExperimentalAbiValidation
25+
126
/*
227
* Copyright (c) 2024. ForteScarlet.
328
*
@@ -30,6 +55,11 @@ plugins {
3055
configJavaCompileWithModule()
3156

3257
kotlin {
58+
@OptIn(ExperimentalAbiValidation::class)
59+
abiValidation {
60+
enabled = false
61+
}
62+
3363
jvmToolchain(11)
3464
compilerOptions {
3565
javaParameters = true

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pluginManagement {
2626
repositories {
2727
mavenCentral()
2828
gradlePluginPortal()
29-
mavenLocal()
29+
// mavenLocal()
3030
}
3131
}
3232

0 commit comments

Comments
 (0)