Switch to templates in the separate script runtime

This commit is contained in:
Ilya Chernikov
2016-10-11 10:03:41 +02:00
parent c2b5c11781
commit 846797ff61
36 changed files with 99 additions and 128 deletions
@@ -70,7 +70,7 @@ class KotlinConsoleKeeper(val project: Project) {
//paramList.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005")
val kotlinPaths = PathUtil.getKotlinPathsForIdeaPlugin()
val replClassPath = listOf(kotlinPaths.compilerPath, kotlinPaths.reflectPath, kotlinPaths.runtimePath)
val replClassPath = listOf(kotlinPaths.compilerPath, kotlinPaths.reflectPath, kotlinPaths.runtimePath, kotlinPaths.scriptRuntimePath)
.map { it.absolutePath }
.joinToString(File.pathSeparator)
@@ -29,13 +29,9 @@ class KotlinJsr223StandardScriptEngineFactory4Idea : KotlinJsr223JvmScriptEngine
KotlinJsr223JvmScriptEngine4Idea(
Disposer.newDisposable(),
this,
listOf(PathUtil.getKotlinPathsForIdeaPlugin().runtimePath),
"kotlin.script.ScriptTemplateWithArgsAndBindings",
{ ctx ->
val bindings = ctx.getBindings(ScriptContext.ENGINE_SCOPE)
arrayOf(
(bindings[ScriptEngine.ARGV] as? Array<*>) ?: emptyArray<String>(),
bindings) },
arrayOf(Array<String>::class.java, Map::class.java)
listOf(PathUtil.getKotlinPathsForIdeaPlugin().runtimePath, PathUtil.getKotlinPathsForIdeaPlugin().scriptRuntimePath),
"kotlin.script.templates.standard.ScriptTemplateWithBindings",
{ ctx -> arrayOf(ctx.getBindings(ScriptContext.ENGINE_SCOPE)) },
arrayOf(Map::class.java)
)
}