Add stdlib, etc. to the script dependencies on compilation
#KT-29293 fixed
This commit is contained in:
+9
-4
@@ -109,7 +109,12 @@ class KJvmCompilerImpl(val hostConfiguration: ScriptingHostConfiguration) : KJvm
|
||||
}
|
||||
)
|
||||
}
|
||||
fun addRoot(moduleName: String, file: File) {
|
||||
|
||||
// TODO: implement logic similar to compiler's -no-stdlib (and -no-reflect?)
|
||||
val standardLibs = arrayListOf("kotlin.stdlib" to KotlinJars.stdlib)
|
||||
KotlinJars.scriptRuntimeOrNull?.let { standardLibs.add("kotlin.script.runtime" to it) }
|
||||
|
||||
for ((moduleName, file) in standardLibs) {
|
||||
if (isModularJava) {
|
||||
add(CLIConfigurationKeys.CONTENT_ROOTS, JvmModulePathRoot(file))
|
||||
add(JVMConfigurationKeys.ADDITIONAL_JAVA_MODULES, moduleName)
|
||||
@@ -117,9 +122,9 @@ class KJvmCompilerImpl(val hostConfiguration: ScriptingHostConfiguration) : KJvm
|
||||
add(CLIConfigurationKeys.CONTENT_ROOTS, JvmClasspathRoot(file))
|
||||
}
|
||||
}
|
||||
// TODO: implement logic similar to compiler's -no-stdlib (and -no-reflect?)
|
||||
addRoot("kotlin.stdlib", KotlinJars.stdlib)
|
||||
KotlinJars.scriptRuntimeOrNull?.let { addRoot("kotlin.script.runtime", it) }
|
||||
updatedConfiguration = ScriptCompilationConfiguration(updatedConfiguration) {
|
||||
dependencies.append(JvmDependency(standardLibs.map { it.second }))
|
||||
}
|
||||
|
||||
put(CommonConfigurationKeys.MODULE_NAME, "kotlin-script") // TODO" take meaningful and valid name from somewhere
|
||||
languageVersionSettings = LanguageVersionSettingsImpl(
|
||||
|
||||
Reference in New Issue
Block a user