Introduce classpath for compiler with scripting in KotlinPaths, fix JSR-223 for Idea

This commit is contained in:
Ilya Chernikov
2019-02-07 16:16:46 +01:00
parent 4c751cdd52
commit d0e78b95c3
2 changed files with 9 additions and 4 deletions
@@ -92,11 +92,15 @@ interface KotlinPaths {
SamWithReceiver(PathUtil.SAM_WITH_RECEIVER_PLUGIN_NAME),
Trove4j(PathUtil.TROVE4J_NAME),
Compiler(PathUtil.KOTLIN_COMPILER_NAME),
ScriptingPlugin(PathUtil.KOTLIN_SCRIPTING_COMPILER_PLUGIN_NAME),
ScriptingLib(PathUtil.KOTLIN_SCRIPTING_COMMON_NAME),
ScriptingJvmLib(PathUtil.KOTLIN_SCRIPTING_JVM_NAME),
}
enum class ClassPaths(val contents: List<Jar> = emptyList()) {
Empty(),
Compiler(Jars.Compiler, Jars.StdLib, Jars.Reflect, Jars.ScriptRuntime, Jars.Trove4j),
Compiler(Jar.Compiler, Jar.StdLib, Jar.Reflect, Jar.ScriptRuntime, Jar.Trove4j),
CompilerWithScripting(Compiler, Jar.ScriptingPlugin, Jar.ScriptingLib, Jar.ScriptingJvmLib)
;
constructor(vararg jars: Jar) : this(jars.asList())
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.daemon.client.DaemonReportingTargets
import org.jetbrains.kotlin.daemon.client.KotlinCompilerClient
import org.jetbrains.kotlin.daemon.client.KotlinRemoteReplCompilerClient
import org.jetbrains.kotlin.daemon.common.*
import org.jetbrains.kotlin.utils.KotlinPaths
import org.jetbrains.kotlin.utils.PathUtil
import java.io.File
import java.util.concurrent.locks.ReentrantReadWriteLock
@@ -44,9 +45,9 @@ class KotlinJsr223JvmScriptEngine4Idea(
) : KotlinJsr223JvmScriptEngineBase(factory) {
private val daemon by lazy {
val path = PathUtil.kotlinPathsForIdeaPlugin.compilerPath
assert(path.exists())
val compilerId = CompilerId.makeCompilerId(path)
val classPath = PathUtil.kotlinPathsForIdeaPlugin.classPath(KotlinPaths.ClassPaths.CompilerWithScripting)
assert(classPath.all { it.exists() })
val compilerId = CompilerId.makeCompilerId(classPath)
val daemonOptions = configureDaemonOptions()
val daemonJVMOptions = DaemonJVMOptions()