Skip to content

Commit

Permalink
How to apply simbot-suspend-transform-extension?
Browse files Browse the repository at this point in the history
  • Loading branch information
ForteScarlet committed Dec 4, 2024
1 parent 928f88c commit 9a02100
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 43 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- dev/main
- master
- main

jobs:
qodana:
if: ${{ !startsWith(github.head_ref, 'dependabot/') }}
Expand All @@ -22,10 +22,10 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
fetch-depth: 0 # a full history is required for pull request analysis
- name: 'Qodana Scan'
uses: JetBrains/qodana-action@main
uses: JetBrains/qodana-action@v2024.2
with:
upload-result: true
github-token: ${{ secrets.FORLIY_ACCESS_TOKEN }}
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} # read the steps about it below
GITHUB_TOKEN: ${{ secrets.FORLIY_ACCESS_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.FORLIY_ACCESS_TOKEN }}
21 changes: 18 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import io.gitlab.arturbosch.detekt.Detekt
import love.forte.gradle.common.core.project.setup
import love.forte.gradle.common.core.repository.Repositories
import love.forte.plugin.suspendtrans.SuspendTransformConfiguration
import love.forte.plugin.suspendtrans.gradle.SuspendTransformGradleExtension
import util.isCi

plugins {
Expand All @@ -28,14 +30,14 @@ plugins {

alias(libs.plugins.detekt)
alias(libs.plugins.kotlinxBinaryCompatibilityValidator)
alias(libs.plugins.suspendTransform) apply false
}

setup(P.ComponentOneBot)

buildscript {
repositories {
mavenCentral()
mavenLocal()
dependencies {
classpath(libs.suspend.transform.gradle)
}
}

Expand All @@ -56,6 +58,19 @@ allprojects {
}
}

subprojects {
afterEvaluate {
if (plugins.hasPlugin(libs.plugins.suspendTransform.get().pluginId)) {
extensions.configure<SuspendTransformGradleExtension>("suspendTransform") {
includeRuntime = false
includeAnnotation = false

// TODO addSimbot?
}
}
}
}

idea {
module.apply {
isDownloadSources = true
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ dependencies {
implementation("io.github.gradle-nexus:publish-plugin:2.0.0")

// simbot suspend transform gradle common
implementation(libs.simbot.gradle)
// compileOnly(libs.simbot.gradle)

// suspend transform
implementation(libs.suspend.transform.gradle)
// implementation(libs.suspend.transform.gradle)

// gradle common
implementation(libs.bundles.gradle.common)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,34 @@
* If not, see <https://www.gnu.org/licenses/>.
*/

import love.forte.simbot.gradle.suspendtransforms.SuspendTransforms

plugins {
id("love.forte.plugin.suspend-transform")
// id("love.forte.plugin.suspend-transform")
}

suspendTransform {
includeRuntime = false
includeAnnotation = false

addJvmTransformers(
// @JvmBlocking
SuspendTransforms.jvmBlockingTransformer,
// @JvmAsync
SuspendTransforms.jvmAsyncTransformer,

// @JvmSuspendTrans
SuspendTransforms.suspendTransTransformerForJvmBlocking,
SuspendTransforms.suspendTransTransformerForJvmAsync,
SuspendTransforms.suspendTransTransformerForJvmReserve,

// @JvmSuspendTransProperty
SuspendTransforms.jvmSuspendTransPropTransformerForBlocking,
SuspendTransforms.jvmSuspendTransPropTransformerForAsync,
SuspendTransforms.jvmSuspendTransPropTransformerForReserve,
)

// addJsTransformers(
// SuspendTransforms.suspendTransTransformerForJsPromise,
// )
}
// suspendTransform {
// includeRuntime = false
// includeAnnotation = false
//
// addJvmTransformers(
// // @JvmBlocking
// SuspendTransforms.jvmBlockingTransformer,
// // @JvmAsync
// SuspendTransforms.jvmAsyncTransformer,
//
// // @JvmSuspendTrans
// SuspendTransforms.suspendTransTransformerForJvmBlocking,
// SuspendTransforms.suspendTransTransformerForJvmAsync,
// SuspendTransforms.suspendTransTransformerForJvmReserve,
//
// // @JvmSuspendTransProperty
// SuspendTransforms.jvmSuspendTransPropTransformerForBlocking,
// SuspendTransforms.jvmSuspendTransPropTransformerForAsync,
// SuspendTransforms.jvmSuspendTransPropTransformerForReserve,
// )
//
// // addJsTransformers(
// // SuspendTransforms.suspendTransTransformerForJsPromise,
// // )
// }


9 changes: 5 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "2.0.20"
kotlin = "2.1.0"
kotlinx-coroutines = "1.9.0"
kotlinx-serialization = "1.7.3"
kotlinx-io = "0.6.0"
Expand All @@ -8,11 +8,11 @@ ktor = "2.3.12"
openjdk-jmh = "1.37"
log4j = "2.24.2"
# simbot
simbot = "4.7.0"
suspendTransform = "2.0.20-0.9.4"
simbot = "4.9.0"
suspendTransform = "2.1.0-0.9.4"
gradleCommon = "0.6.0"
# ksp
ksp = "2.0.20-1.0.25"
ksp = "2.1.0-1.0.29"
# https://square.github.io/kotlinpoet/
kotlinPoet = "2.0.0"
# https://mockk.io/
Expand Down Expand Up @@ -113,6 +113,7 @@ detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
# binary-compatibility-validator
# https://github.com/Kotlin/binary-compatibility-validator
kotlinxBinaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.16.3" }
suspendTransform = { id = "love.forte.plugin.suspend-transform", version.ref = "suspendTransform" }

[bundles]
gradle-common = ["gradle-common-core", "gradle-common-multiplatform", "gradle-common-publication"]
Expand Down
2 changes: 1 addition & 1 deletion qudana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ projectJDK: azul-21 #(Applied in CI/CD pipeline)
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)

#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-jvm-community:latest
linter: jetbrains/qodana-jvm-community:2024.2
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
`simbot-onebot-dokka-partial-configure`
`simbot-onebot-suspend-transform-configure`
// `simbot-onebot-suspend-transform-configure`
alias(libs.plugins.suspendTransform)
alias(libs.plugins.ksp)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
`simbot-onebot-dokka-partial-configure`
`simbot-onebot-suspend-transform-configure`
// `simbot-onebot-suspend-transform-configure`

alias(libs.plugins.suspendTransform)
alias(libs.plugins.ksp)
}

Expand Down

0 comments on commit 9a02100

Please sign in to comment.