-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experimental | Support Kotlin Script(.kts)
我猜它肯定报错 脚本模块需要重构
- Loading branch information
1 parent
e7e28dc
commit bc542e8
Showing
6 changed files
with
80 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
project/module-script/src/main/java/cn/fd/ratziel/core/env/ScriptEnv.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package cn.fd.ratziel.core.env; | ||
|
||
import taboolib.common.env.RuntimeDependencies; | ||
import taboolib.common.env.RuntimeDependency; | ||
|
||
/** | ||
* ScriptEnv | ||
* | ||
* @author TheFloodDragon | ||
* @since 2024/7/14 14:54 | ||
*/ | ||
@RuntimeDependencies({ | ||
// Kotlin Script | ||
@RuntimeDependency( | ||
value = "!org.jetbrains.kotlin:kotlin-script-runtime:" + CoreEnv.KOTLIN_VERSION, | ||
transitive = false | ||
), | ||
@RuntimeDependency( | ||
value = "!org.jetbrains.kotlin:kotlin-script-common:" + CoreEnv.KOTLIN_VERSION, | ||
transitive = false | ||
), | ||
@RuntimeDependency( | ||
value = "!org.jetbrains.kotlin:kotlin-script-jvm:" + CoreEnv.KOTLIN_VERSION, | ||
transitive = false | ||
), | ||
@RuntimeDependency( | ||
value = "!org.jetbrains.kotlin:kotlin-script-jvm-host:" + CoreEnv.KOTLIN_VERSION, | ||
transitive = false | ||
), | ||
@RuntimeDependency( | ||
value = "!org.jetbrains.kotlin:kotlin-script-compiler:" + CoreEnv.KOTLIN_VERSION, | ||
transitive = false | ||
), | ||
@RuntimeDependency( | ||
value = "!org.jetbrains.kotlin:kotlin-script-jsr233:" + CoreEnv.KOTLIN_VERSION, | ||
transitive = false | ||
), | ||
// JavaScript | ||
@RuntimeDependency( | ||
value = "!org.openjdk.nashorn:nashorn-core:15.4", | ||
test = "!org.openjdk.nashorn.api.scripting.NashornScriptEngine" | ||
), | ||
// Jexl | ||
@RuntimeDependency( | ||
value = "!org.apache.commons:commons-jexl3:3.4.0", | ||
test = "!org.apache.commons.jexl3.JexlEngine" | ||
)} | ||
) | ||
public class ScriptEnv { | ||
} |
12 changes: 12 additions & 0 deletions
12
project/module-script/src/main/kotlin/cn/fd/ratziel/script/KotlinScriptLang.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package cn.fd.ratziel.script | ||
|
||
/** | ||
* KotlinScriptLang | ||
* | ||
* @author TheFloodDragon | ||
* @since 2024/7/14 15:40 | ||
*/ | ||
object KotlinScriptLang : EnginedScriptLanguage( | ||
"kts", // 引擎名称 | ||
"kts", "KTS", "KotlinScript", "kotlin-script", "KotlinScripting", "kotlin-scripting" // 语言名称 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters