Skip to content

Commit 3b00631

Browse files
authored
Merge pull request #152 from simple-robot/dev/main
Release: v1.5.0
2 parents dae30f4 + d467c3c commit 3b00631

File tree

18 files changed

+125
-1668
lines changed

18 files changed

+125
-1668
lines changed

.github/workflows/publish-release.yml

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
needs: run-test
5151
# 交叉编译 support
5252
# see https://kotlinlang.org/docs/multiplatform-publish-lib.html#host-requirements
53-
runs-on: macos-latest
53+
runs-on: ubuntu-latest
5454
steps:
5555
# 检出仓库代码
5656
- uses: actions/checkout@v4
@@ -111,36 +111,6 @@ jobs:
111111
generate_release_notes: true
112112
prerelease: ${{ contains(github.ref_name, 'preview') || contains(github.ref_name, 'alpha') }}
113113

114-
publish-snapshots:
115-
name: Publish snapshots
116-
# 交叉编译 support
117-
# see https://kotlinlang.org/docs/multiplatform-publish-lib.html#host-requirements
118-
runs-on: macos-latest
119-
needs: publish-releases
120-
steps:
121-
- uses: actions/checkout@v4
122-
- uses: actions/setup-java@v4
123-
with:
124-
distribution: ${{ env.JAVA_DISTRIBUTION }}
125-
java-version: ${{ env.JAVA_VERSION }}
126-
127-
# setup Gradle
128-
- name: Setup Gradle
129-
uses: gradle/actions/setup-gradle@v3
130-
with:
131-
gradle-version: ${{ env.GRADLE_VERSION }}
132-
arguments: |
133-
publishToSonatype
134-
closeAndReleaseStagingRepositories
135-
--info
136-
--warning-mode all
137-
-x test
138-
--build-cache
139-
-Porg.gradle.jvmargs="-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
140-
env:
141-
SIMBOT_IS_SNAPSHOT: true
142-
SIMBOT_SNAPSHOT_ONLY: true
143-
144114
deploy-doc:
145115
name: Deploy KDoc
146116
runs-on: ubuntu-latest

.github/workflows/publish-snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
publish-snapshots:
7070
name: Publish snapshots
7171
needs: run-test
72-
runs-on: macos-latest
72+
runs-on: ubuntu-latest
7373
steps:
7474
- uses: actions/checkout@v4
7575
- uses: actions/setup-java@v4

.github/workflows/qodana_code_quality.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- dev/main
88
- master
99
- main
10-
10+
1111
jobs:
1212
qodana:
1313
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
@@ -22,10 +22,10 @@ jobs:
2222
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
2323
fetch-depth: 0 # a full history is required for pull request analysis
2424
- name: 'Qodana Scan'
25-
uses: JetBrains/qodana-action@main
25+
uses: JetBrains/qodana-action@v2024.2
2626
with:
2727
upload-result: true
2828
github-token: ${{ secrets.FORLIY_ACCESS_TOKEN }}
2929
env:
3030
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} # read the steps about it below
31-
GITHUB_TOKEN: ${{ secrets.FORLIY_ACCESS_TOKEN }}
31+
# GITHUB_TOKEN: ${{ secrets.FORLIY_ACCESS_TOKEN }}

build.gradle.kts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import io.gitlab.arturbosch.detekt.Detekt
1919
import love.forte.gradle.common.core.project.setup
2020
import love.forte.gradle.common.core.repository.Repositories
21+
import love.forte.plugin.suspendtrans.gradle.SuspendTransformGradleExtension
22+
import love.forte.simbot.gradle.suspendtransforms.addSimbotJvmTransformers
2123
import util.isCi
2224

2325
plugins {
@@ -28,14 +30,16 @@ plugins {
2830

2931
alias(libs.plugins.detekt)
3032
alias(libs.plugins.kotlinxBinaryCompatibilityValidator)
33+
alias(libs.plugins.suspendTransform) apply false
3134
}
3235

3336
setup(P.ComponentOneBot)
3437

3538
buildscript {
36-
repositories {
37-
mavenCentral()
38-
mavenLocal()
39+
dependencies {
40+
// suspend-transform-gradle = { module = "love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle", version.ref = "suspendTransform" }
41+
classpath(libs.simbot.gradle)
42+
// classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:4.9.0")
3943
}
4044
}
4145

@@ -56,6 +60,19 @@ allprojects {
5660
}
5761
}
5862

63+
subprojects {
64+
afterEvaluate {
65+
if (plugins.hasPlugin(libs.plugins.suspendTransform.get().pluginId)) {
66+
extensions.configure<SuspendTransformGradleExtension>("suspendTransform") {
67+
includeRuntime = false
68+
includeAnnotation = false
69+
70+
addSimbotJvmTransformers()
71+
}
72+
}
73+
}
74+
}
75+
5976
idea {
6077
module.apply {
6178
isDownloadSources = true

buildSrc/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ dependencies {
3737
implementation("io.github.gradle-nexus:publish-plugin:2.0.0")
3838

3939
// simbot suspend transform gradle common
40-
implementation(libs.simbot.gradle)
40+
// compileOnly(libs.simbot.gradle)
4141

4242
// suspend transform
43-
implementation(libs.suspend.transform.gradle)
43+
// implementation(libs.suspend.transform.gradle)
4444

4545
// gradle common
4646
implementation(libs.bundles.gradle.common)

buildSrc/src/main/kotlin/JsConfig.kt

Lines changed: 2 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -15,96 +15,12 @@
1515
* If not, see <https://www.gnu.org/licenses/>.
1616
*/
1717

18-
import org.gradle.api.Project
19-
import org.gradle.kotlin.dsl.the
20-
import org.gradle.kotlin.dsl.withType
2118
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
22-
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmJsTargetDsl
23-
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
2419

2520

26-
inline fun KotlinJsTargetDsl.configJs(
27-
nodeJs: Boolean = true,
28-
browser: Boolean = true,
29-
block: () -> Unit = {}
30-
) {
31-
if (nodeJs) {
32-
nodejs()
33-
// {
34-
//// testTask {
35-
//// useMocha {
36-
//// timeout = "10000"
37-
//// }
38-
//// }
39-
// }
40-
}
41-
42-
if (browser) {
43-
browser()
44-
// {
45-
// testTask{
46-
// useKarma {
47-
// useChromeHeadless()
48-
// // useConfigDirectory(File(project.rootProject.projectDir, "karma"))
49-
// }
50-
// }
51-
// }
52-
}
53-
54-
binaries.library()
55-
block()
56-
}
57-
58-
59-
fun Project.configJsTestTasks() {
60-
// val shouldRunJsBrowserTest = !hasProperty("teamcity") || hasProperty("enable-js-tests")
61-
// if (shouldRunJsBrowserTest) return
62-
tasks.findByName("cleanJsBrowserTest")?.apply {
63-
onlyIf { false }
64-
}
65-
tasks.findByName("jsBrowserTest")?.apply {
66-
onlyIf { false }
67-
}
68-
}
69-
70-
inline fun KotlinWasmJsTargetDsl.configWasmJs(
71-
nodeJs: Boolean = true,
72-
browser: Boolean = true,
73-
block: () -> Unit = {}
74-
) {
75-
if (nodeJs && isLinux) {
76-
// win in candy node `21.0.0-v8-canary202309143a48826a08` is not supported
77-
// nodejs()
78-
}
79-
80-
if (browser) {
81-
browser {
82-
testTask{
83-
useKarma {
84-
useChromeHeadless()
85-
// useConfigDirectory(File(project.rootProject.projectDir, "karma"))
86-
}
87-
}
88-
}
89-
}
90-
21+
fun KotlinJsTargetDsl.configJs() {
22+
nodejs()
9123
binaries.library()
92-
block()
9324
}
9425

95-
inline fun Project.configWasmJsTest(block: () -> Unit = {}) {
96-
if (false) {
97-
// 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
98-
rootProject.the<NodeJsRootExtension>().apply {
99-
// nodeVersion = "21.0.0-v8-canary202309143a48826a08"
100-
version = "21.0.0-v8-canary202309143a48826a08"
101-
downloadBaseUrl = "https://nodejs.org/download/v8-canary"
102-
}
103-
104-
tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().configureEach {
105-
args.add("--ignore-engines")
106-
}
107-
}
10826

109-
block()
110-
}

buildSrc/src/main/kotlin/JvmConfig.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,17 @@
1818
import org.gradle.api.Project
1919
import org.gradle.api.tasks.SourceSetContainer
2020
import org.gradle.api.tasks.compile.JavaCompile
21-
import org.gradle.kotlin.dsl.assign
2221
import org.gradle.kotlin.dsl.get
2322
import org.gradle.kotlin.dsl.getByName
2423
import org.gradle.kotlin.dsl.withType
2524
import org.gradle.process.CommandLineArgumentProvider
26-
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
2725
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
26+
import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension
2827
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
2928
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
30-
import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension
3129
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
3230

3331

34-
@OptIn(ExperimentalKotlinGradlePluginApi::class)
3532
inline fun KotlinJvmTarget.configJava(jdkVersion: Int, crossinline block: KotlinJvmTarget.() -> Unit = {}) {
3633
withJava()
3734
compilerOptions {
@@ -50,8 +47,7 @@ inline fun KotlinJvmTarget.configJava(jdkVersion: Int, crossinline block: Kotlin
5047
block()
5148
}
5249

53-
54-
fun KotlinTopLevelExtension.configJavaToolchain(jdkVersion: Int) {
50+
fun KotlinBaseExtension.configJavaToolchain(jdkVersion: Int) {
5551
jvmToolchain(jdkVersion)
5652
}
5753

@@ -71,10 +67,12 @@ inline fun KotlinJvmProjectExtension.configKotlinJvm(
7167
) {
7268
configJavaToolchain(jdkVersion)
7369
compilerOptions {
74-
javaParameters = true
70+
javaParameters.set(true)
7571
jvmTarget.set(JvmTarget.fromTarget(jdkVersion.toString()))
76-
// freeCompilerArgs.addAll("-Xjvm-default=all", "-Xjsr305=strict")
77-
freeCompilerArgs.set(freeCompilerArgs.getOrElse(emptyList()) + listOf("-Xjvm-default=all", "-Xjsr305=strict"))
72+
freeCompilerArgs.addAll(
73+
"-Xjvm-default=all",
74+
"-Xjsr305=strict"
75+
)
7876
}
7977
block()
8078
}

buildSrc/src/main/kotlin/P.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ object P {
3737
override val description: String get() = DESCRIPTION
3838
override val homepage: String get() = HOMEPAGE
3939

40-
const val VERSION = "1.4.5"
41-
const val NEXT_VERSION = "1.4.6"
40+
const val VERSION = "1.5.0"
41+
const val NEXT_VERSION = "1.5.1"
4242

4343
override val snapshotVersion = "$NEXT_VERSION-SNAPSHOT"
4444
override val version = if (isSnapshot()) snapshotVersion else VERSION
@@ -91,5 +91,3 @@ private fun initIsSnapshot(): Boolean {
9191
fun isSnapshot(): Boolean = _isSnapshot
9292

9393
fun isSimbotLocal(): Boolean = systemProp("SIMBOT_LOCAL").toBoolean()
94-
95-
val isLinux: Boolean = systemProp("os.name")?.contains("linux", true) ?: false

buildSrc/src/main/kotlin/simbot-onebot-suspend-transform-configure.gradle.kts

Lines changed: 0 additions & 50 deletions
This file was deleted.

gradle.properties

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ kotlin.js.generate.executable.default=false
44

55
# Such dependencies are not applicable for Kotlin/Native, consider changing the dependency type to 'implementation' or 'api'.
66
# To disable this warning, set the kotlin.native.ignoreIncorrectDependencies=true project property
7-
kotlin.native.ignoreIncorrectDependencies=true
7+
#
8+
# 2024/12/04 Update: w: The `kotlin.native.ignoreIncorrectDependencies` deprecated property is used in your build.
9+
# Please, stop using it as it is unsupported and may apply no effect to your build.
10+
# kotlin.native.ignoreIncorrectDependencies=true
811

912
# 'expect'/'actual' classes (including interfaces, objects, annotations, enums, and 'actual' typealiases) are in Beta. You can use -Xexpect-actual-classes flag to suppress this warning. Also see: https://youtrack.jetbrains.com/issue/KT-61573
1013
# "-Xexpect-actual-classes"
@@ -27,3 +30,6 @@ org.gradle.caching=true
2730
## > null cannot be cast to non-null type org.jetbrains.kotlin.load.java.structure.impl.JavaClassImpl
2831
## https://github.com/google/ksp/issues/1929
2932
ksp.useKSP2=false
33+
34+
# https://kotlinlang.org/docs/multiplatform-publish-lib.html#host-requirements
35+
kotlin.native.enableKlibsCrossCompilation=true

0 commit comments

Comments
 (0)