Hi <@U0CHHN4F4>, I have embedded definition of the...
# scripting
s
Hi @ilya.chernikov, I have embedded definition of the script inside my IntelliJ plugin but ScriptDefinitionsProvider only support jar files as classpath, there is anyway to use the current classpath to find the definition?
i
Hi Gabriel! The easy way to do it is definitely a missing piece now. With 1.4 (starting from M3 EAP due to quite soon), you'll get an extended interface, in particular - this method - https://github.com/JetBrains/kotlin/blob/1.4-M3/libraries/scripting/intellij/src/kotlin/script/experimental/intellij/scriptDefinitionProvider.kt#L48 - allows you to modify list of provided definitions, so you can basically return empty classpath and classes list and then provide all your definitions via the
provideDefinitions
function. Alternatively you may try to use
scriptCompilationClasspathFromContextOrNull
helpers to extract classpath right in the
ScriptDefinitionsProvider.getDefinitionsClassPath
.
I created an issue to address this in some future - https://youtrack.jetbrains.com/issue/KT-39901