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
This commit is contained in:
@@ -68,7 +68,7 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
configuration.put(JVMConfigurationKeys.DISABLE_STANDARD_SCRIPT_DEFINITION, true)
|
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 (pluginLoadResult != ExitCode.OK) return pluginLoadResult
|
||||||
|
|
||||||
if (!arguments.script && arguments.buildFile == null) {
|
if (!arguments.script && arguments.buildFile == null) {
|
||||||
@@ -217,7 +217,7 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
|
|
||||||
override fun getPerformanceManager(): CommonCompilerPerformanceManager = performanceManager
|
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<String> = arguments.pluginClasspaths?.asIterable() ?: emptyList()
|
var pluginClasspaths: Iterable<String> = arguments.pluginClasspaths?.asIterable() ?: emptyList()
|
||||||
val pluginOptions = arguments.pluginOptions?.toMutableList() ?: ArrayList()
|
val pluginOptions = arguments.pluginOptions?.toMutableList() ?: ArrayList()
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
// if scripting plugin is not enabled explicitly (probably from another path) and not in the classpath already,
|
// if scripting plugin is not enabled explicitly (probably from another path) and not in the classpath already,
|
||||||
// try to find and enable it implicitly
|
// try to find and enable it implicitly
|
||||||
if (!explicitOrLoadedScriptingPlugin) {
|
if (!explicitOrLoadedScriptingPlugin) {
|
||||||
val libPath = paths?.libPath?.takeIf { it.exists() } ?: File(".")
|
val libPath = PathUtil.kotlinPathsForCompiler.libPath.takeIf { it.exists() && it.isDirectory } ?: File(".")
|
||||||
with(PathUtil) {
|
with(PathUtil) {
|
||||||
val jars = arrayOf(
|
val jars = arrayOf(
|
||||||
KOTLIN_SCRIPTING_COMPILER_PLUGIN_JAR, KOTLIN_SCRIPTING_COMMON_JAR,
|
KOTLIN_SCRIPTING_COMPILER_PLUGIN_JAR, KOTLIN_SCRIPTING_COMMON_JAR,
|
||||||
|
|||||||
Reference in New Issue
Block a user