From 92d4d986c8df5ae815a47e1c7332ebcac7b7f48d Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Thu, 5 Jul 2018 17:18:19 +0200 Subject: [PATCH] Take path to scripting plugin libs only from compiler jar path... ignoring all "kotlin home" settings, since we need to load a compatible plugin. Fixes #KT-24946 --- .../cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt index 126adfbd707..0bc2ee1034a 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt @@ -68,7 +68,7 @@ class K2JVMCompiler : CLICompiler() { configuration.put(JVMConfigurationKeys.DISABLE_STANDARD_SCRIPT_DEFINITION, true) } - val pluginLoadResult = loadPlugins(paths, arguments, configuration) + val pluginLoadResult = loadPlugins(arguments, configuration) if (pluginLoadResult != ExitCode.OK) return pluginLoadResult if (!arguments.script && arguments.buildFile == null) { @@ -217,7 +217,7 @@ class K2JVMCompiler : CLICompiler() { override fun getPerformanceManager(): CommonCompilerPerformanceManager = performanceManager - private fun loadPlugins(paths: KotlinPaths?, arguments: K2JVMCompilerArguments, configuration: CompilerConfiguration): ExitCode { + private fun loadPlugins(arguments: K2JVMCompilerArguments, configuration: CompilerConfiguration): ExitCode { var pluginClasspaths: Iterable = arguments.pluginClasspaths?.asIterable() ?: emptyList() val pluginOptions = arguments.pluginOptions?.toMutableList() ?: ArrayList() @@ -233,7 +233,7 @@ class K2JVMCompiler : CLICompiler() { // if scripting plugin is not enabled explicitly (probably from another path) and not in the classpath already, // try to find and enable it implicitly if (!explicitOrLoadedScriptingPlugin) { - val libPath = paths?.libPath?.takeIf { it.exists() } ?: File(".") + val libPath = PathUtil.kotlinPathsForCompiler.libPath.takeIf { it.exists() && it.isDirectory } ?: File(".") with(PathUtil) { val jars = arrayOf( KOTLIN_SCRIPTING_COMPILER_PLUGIN_JAR, KOTLIN_SCRIPTING_COMMON_JAR,