From 1f4fab0047b28fe6a0698b57788e4e17fec4a80f Mon Sep 17 00:00:00 2001 From: Dmitry Kovanikov Date: Wed, 9 Sep 2015 19:48:39 +0300 Subject: [PATCH] [ide-console] Add all paths of compiled module (production, test) --- .../kotlin/console/KotlinConsoleKeeper.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/idea/idea-repl/src/org/jetbrains/kotlin/console/KotlinConsoleKeeper.kt b/idea/idea-repl/src/org/jetbrains/kotlin/console/KotlinConsoleKeeper.kt index 9d07bc13c6b..f2c87d5cb3b 100644 --- a/idea/idea-repl/src/org/jetbrains/kotlin/console/KotlinConsoleKeeper.kt +++ b/idea/idea-repl/src/org/jetbrains/kotlin/console/KotlinConsoleKeeper.kt @@ -19,6 +19,7 @@ package org.jetbrains.kotlin.console import com.intellij.execution.Platform import com.intellij.execution.configurations.GeneralCommandLine import com.intellij.execution.configurations.JavaParameters +import com.intellij.execution.configurations.ParametersList import com.intellij.openapi.compiler.ex.CompilerPathsEx import com.intellij.openapi.components.ServiceManager import com.intellij.openapi.module.Module @@ -80,9 +81,7 @@ public class KotlinConsoleKeeper(val project: Project) { // path to compiler and his options paramList.add("org.jetbrains.kotlin.cli.jvm.K2JVMCompiler") - // add path to compiled output in kompiler classpath - paramList.add("-cp") - paramList.add(pathToCompiledOutput(module)) + addPathToCompiledOutput(paramList, module) return commandLine } @@ -103,12 +102,15 @@ public class KotlinConsoleKeeper(val project: Project) { return params } - private fun pathToCompiledOutput(module: Module): String { - val outPaths = CompilerPathsEx.getOutputPaths(arrayOf(module)) - val compiledModulePath = outPaths.find { "production" in it } ?: return "" - val moduleDependencies = OrderEnumerator.orderEntries(module).recursively().pathsList.pathsString + private fun addPathToCompiledOutput(paramList: ParametersList, module: Module) { + val pathSeparator = Platform.current().pathSeparator.toString() - return "$compiledModulePath${Platform.current().pathSeparator}$moduleDependencies" + val compiledModulePath = CompilerPathsEx.getOutputPaths(arrayOf(module)).join(pathSeparator) + val moduleDependencies = OrderEnumerator.orderEntries(module).recursively().pathsList.pathsString + val compiledOutputClasspath = "$compiledModulePath$pathSeparator$moduleDependencies" + + paramList.add("-cp") + paramList.add(compiledOutputClasspath) } companion object {