File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ plugins {
77
88defineMetadataModules()
99
10+ dependencies {
11+ " coreMindustryApi" (" com.github.TinyLake.MindustryX:core" )
12+ configurations.findByName(" coreBukkitApi" )?.invoke(" dev.folia:folia-api" )
13+ }
14+
1015// 全局编译器配置
1116allprojects {
1217 tasks.withType<KotlinCompile >().configureEach {
Original file line number Diff line number Diff line change @@ -5,17 +5,23 @@ package kcp
55import cf.wayzer.scriptAgent.events.ScriptCompileEvent
66import cf.wayzer.scriptAgent.util.DependencyManager
77import cf.wayzer.scriptAgent.util.maven.Dependency
8+ import java.io.File
89
9- val pluginFile by lazy {
10- DependencyManager {
11- val dep = " org.jetbrains.kotlin:kotlin-serialization-compiler-plugin-embeddable:${Config .kotlinVersion} "
12- require(Dependency .parse(dep), resolveChild = false )
13- load()
14- getFiles().single()
10+ var pluginFile: File ? = null
11+
12+ suspend fun getOrLoad (): File {
13+ if (pluginFile == null ) {
14+ pluginFile = DependencyManager {
15+ val dep = " org.jetbrains.kotlin:kotlin-serialization-compiler-plugin-embeddable:${Config .kotlinVersion} "
16+ require(Dependency .parse(dep), resolveChild = false )
17+ load()
18+ getFiles().single()
19+ }
1520 }
21+ return pluginFile!!
1622}
1723
1824listenTo<ScriptCompileEvent > {
1925 if (! dependsOn(scriptInfo)) return @listenTo
20- addCompileOptions(" -Xplugin=${pluginFile .absolutePath} " )
26+ addCompileOptions(" -Xplugin=${getOrLoad() .absolutePath} " )
2127}
You can’t perform that action at this time.
0 commit comments