[Analysis API] add kotlin-stdlib to Analysis API tests via KotlinStandardLibrariesPathProvider
to customize it outside kotlin repo
This commit is contained in:
+7
-7
@@ -29,10 +29,10 @@ import org.jetbrains.kotlin.test.model.TestModule
|
|||||||
import org.jetbrains.kotlin.test.services.*
|
import org.jetbrains.kotlin.test.services.*
|
||||||
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator
|
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator
|
||||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||||
import org.jetbrains.kotlin.utils.KotlinPaths
|
|
||||||
import org.jetbrains.kotlin.utils.PathUtil
|
import org.jetbrains.kotlin.utils.PathUtil
|
||||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
import kotlin.io.path.absolute
|
||||||
import kotlin.io.path.exists
|
import kotlin.io.path.exists
|
||||||
import kotlin.io.path.extension
|
import kotlin.io.path.extension
|
||||||
import kotlin.io.path.nameWithoutExtension
|
import kotlin.io.path.nameWithoutExtension
|
||||||
@@ -161,7 +161,9 @@ object TestModuleStructureFactory {
|
|||||||
libraryName: String = jar.nameWithoutExtension,
|
libraryName: String = jar.nameWithoutExtension,
|
||||||
): KtLibraryModuleImpl {
|
): KtLibraryModuleImpl {
|
||||||
check(jar.extension == "jar")
|
check(jar.extension == "jar")
|
||||||
check(jar.exists())
|
check(jar.exists()) {
|
||||||
|
"library $jar does not exist"
|
||||||
|
}
|
||||||
return KtLibraryModuleImpl(
|
return KtLibraryModuleImpl(
|
||||||
libraryName,
|
libraryName,
|
||||||
JvmPlatforms.defaultJvmPlatform,
|
JvmPlatforms.defaultJvmPlatform,
|
||||||
@@ -179,12 +181,10 @@ object TestModuleStructureFactory {
|
|||||||
): List<KtLibraryModule> {
|
): List<KtLibraryModule> {
|
||||||
val configurationKind = JvmEnvironmentConfigurator.extractConfigurationKind(testModule.directives)
|
val configurationKind = JvmEnvironmentConfigurator.extractConfigurationKind(testModule.directives)
|
||||||
if (!configurationKind.withRuntime) return emptyList()
|
if (!configurationKind.withRuntime) return emptyList()
|
||||||
|
val lib = testServices.standardLibrariesPathProvider.runtimeJarForTests().toPath().absolute()
|
||||||
return listOf(
|
return listOf(
|
||||||
KotlinPaths.Jar.StdLib to PathUtil.KOTLIN_JAVA_STDLIB_NAME,
|
createKtLibraryModuleByJar(lib, testServices, project, PathUtil.KOTLIN_JAVA_STDLIB_NAME),
|
||||||
).map { (jar, name) ->
|
)
|
||||||
val lib = PathUtil.kotlinPathsForDistDirectory.jar(jar).toPath().toAbsolutePath()
|
|
||||||
createKtLibraryModuleByJar(lib, testServices, project, name)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getJdkModule(
|
private fun getJdkModule(
|
||||||
|
|||||||
Reference in New Issue
Block a user