[kotlin] fix "IllegalStateException: Could not find stdlib"

The commit removes all the KLib resolution logic,
now Analysis API Standalone clients need to provide all the KLib
list directly.

The resolution logic was removed as too error-prone and requiring compiler configurations.

Kotlin Gradle plugin can provide a full set of required KLibs,
so if a client is a Gradle plugin, this should not be an issue.

Probably, some fancy API which will explicitly perform all KLib dependency searches
should be introduced in the future (KT-63395)

^KT-63126 fixed
This commit is contained in:
Ilya Kirillov
2023-11-06 11:49:46 +01:00
committed by Space Team
parent 1c17f4a835
commit 6aeabc83ea
13 changed files with 206 additions and 13 deletions
@@ -69,7 +69,7 @@ internal object CastCompatibleKotlinNativeClassLoader {
val kotlinNativeClassLoader = NativeTestSupport.computeNativeClassLoader(this::class.java.classLoader)
}
private object NativeTestSupport {
internal object NativeTestSupport {
private val NAMESPACE = ExtensionContext.Namespace.create(NativeTestSupport::class.java.simpleName)
/*************** Test process settings ***************/
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.cli.common.messages.*
import org.jetbrains.kotlin.compilerRunner.OutputItemsCollectorImpl
import org.jetbrains.kotlin.compilerRunner.processCompilerOutput
import org.jetbrains.kotlin.config.Services
import org.jetbrains.kotlin.konan.test.blackbox.support.NativeTestSupport
import org.jetbrains.kotlin.konan.test.blackbox.support.settings.KotlinNativeTargets
import java.io.ByteArrayOutputStream
import java.io.File
@@ -20,7 +21,7 @@ import kotlin.time.measureTime
import kotlin.time.measureTimedValue
import org.jetbrains.kotlin.konan.file.File as KonanFile
internal data class CompilationToolCallResult(
data class CompilationToolCallResult(
val exitCode: ExitCode,
val toolOutput: String,
val toolOutputHasErrors: Boolean,
@@ -74,6 +75,12 @@ internal fun callCompiler(compilerArgs: Array<String>, kotlinNativeClassLoader:
return CompilationToolCallResult(exitCode, compilerOutput, messageCollector.hasErrors(), duration)
}
fun callCompilerWithoutOutputInterceptor(compilerArgs: Array<String>): CompilationToolCallResult {
val compilerClassLoader = NativeTestSupport.computeNativeClassLoader(parent = null).classLoader
return callCompilerWithoutOutputInterceptor(compilerArgs, compilerClassLoader)
}
internal fun callCompilerWithoutOutputInterceptor(
compilerArgs: Array<String>,
kotlinNativeClassLoader: ClassLoader