Refactor script definitions and resolving/refining infrastructure:

- implement wrappers to wrap old and new API providers and resolvers
- make old API deprecated (with error where possible)
- drop old internal classes related to the old API
- refactor usages accordingly
- fix and add missing features to the scripting API where necessary
This commit is contained in:
Ilya Chernikov
2019-05-12 22:26:37 +02:00
parent e5054f9648
commit e542c9ea84
94 changed files with 1554 additions and 764 deletions
@@ -48,6 +48,7 @@ import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
import org.jetbrains.kotlin.resolve.AnalyzingUtils
import java.io.File
import kotlin.script.experimental.api.valueOrNull
class KtCompilingExecutor(file: ScratchFile) : ScratchExecutor(file) {
companion object {
@@ -186,8 +187,10 @@ class KtCompilingExecutor(file: ScratchFile) : ScratchExecutor(file) {
javaParameters.classPath.addAll(JavaParametersBuilder.getModuleDependencies(module))
}
val scriptDependencies = ScriptDependenciesManager.getInstance(originalFile.project).getScriptDependencies(originalFile.virtualFile)
javaParameters.classPath.addAll(scriptDependencies.classpath.map { it.absolutePath })
ScriptDependenciesManager.getInstance(originalFile.project)
.getRefinedCompilationConfiguration(originalFile.virtualFile)?.valueOrNull()?.let {
javaParameters.classPath.addAll(it.dependenciesClassPath.map { f -> f.absolutePath })
}
return javaParameters.toCommandLine()
}