Skip to content

Commit

Permalink
Shrink it
Browse files Browse the repository at this point in the history
  • Loading branch information
Seggan committed Jan 25, 2024
1 parent d25093a commit b52d90c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
13 changes: 9 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ repositories {

dependencies {
library(kotlin("stdlib"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0-RC2")
library("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0-RC2")

implementation(kotlin("scripting-common"))
implementation(kotlin("scripting-jvm"))
implementation(kotlin("scripting-jvm-host"))
library(kotlin("scripting-common"))
library(kotlin("scripting-jvm"))
library(kotlin("scripting-jvm-host"))

compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
compileOnly("com.github.Slimefun:Slimefun4:RC-36")
Expand Down Expand Up @@ -46,6 +46,11 @@ tasks.shadowJar {
relocate("org.bstats", "io.github.addoncommunity.galactifun.bstats")
relocate("co.aikar.commands", "io.github.addoncommunity.galactifun.acf")
relocate("co.aikar.locales", "io.github.addoncommunity.galactifun.acf.locales")

dependencies {
exclude(dependency("org.jetbrains.kotlin:kotlin-stdlib"))
exclude(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk8"))
}
}

bukkit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import org.bukkit.Material
import kotlin.script.experimental.annotations.KotlinScript
import kotlin.script.experimental.api.*
import kotlin.script.experimental.jvm.baseClassLoader
import kotlin.script.experimental.jvm.dependenciesFromCurrentContext
import kotlin.script.experimental.jvm.dependenciesFromClassloader
import kotlin.script.experimental.jvm.jvm
import kotlin.script.experimental.jvm.jvmTarget
import kotlin.script.experimental.jvmhost.BasicJvmScriptingHost
import kotlin.script.experimental.jvmhost.createJvmCompilationConfigurationFromTemplate
import kotlin.script.experimental.jvmhost.createJvmEvaluationConfigurationFromTemplate

@KotlinScript(
fileExtension = "planet.kts",
Expand All @@ -40,7 +38,7 @@ object PlanetScriptConfig : ScriptCompilationConfiguration({
defaultImports(Material::class, BaseUniverse::class, TheUniverse::class, Earth::class, Moon::class)
compilerOptions.append("-Xadd-modules=ALL-MODULE-PATH")
jvm {
dependenciesFromCurrentContext(wholeClasspath = true)
dependenciesFromClassloader(classLoader = pluginInstance::class.java.classLoader, wholeClasspath = true)
jvmTarget("17")
}
})
Expand All @@ -52,7 +50,5 @@ object PlanetScriptEval : ScriptEvaluationConfiguration({
})

fun evalScript(script: SourceCode): ResultWithDiagnostics<EvaluationResult> {
val config = createJvmCompilationConfigurationFromTemplate<PlanetScript>()
val evalConfig = createJvmEvaluationConfigurationFromTemplate<PlanetScript>()
return BasicJvmScriptingHost().eval(script, config, evalConfig)
return BasicJvmScriptingHost().eval(script, PlanetScriptConfig, PlanetScriptEval)
}

0 comments on commit b52d90c

Please sign in to comment.