Allow specify path of compiler extension points for ide tests

This commit is contained in:
Ilya Kirillov
2021-06-23 16:09:12 +02:00
committed by TeamCityServer
parent 0104b1275f
commit 8ac2a48eaf
2 changed files with 5 additions and 0 deletions
@@ -51,6 +51,10 @@ public class CLIConfigurationKeys {
public static final CompilerConfigurationKey<Integer> REPEAT_COMPILE_MODULES =
CompilerConfigurationKey.create("debug key for profiling, repeats compileModules");
// used in FIR IDE uast tests
public static final CompilerConfigurationKey<File> PATH_TO_KOTLIN_COMPILER_JAR =
CompilerConfigurationKey.create("jar of Kotlin compiler in Kotlin plugin");
private CLIConfigurationKeys() {
}
}
@@ -566,6 +566,7 @@ class KotlinCoreEnvironment private constructor(
?: PathUtil.getResourcePathForClass(this::class.java).takeIf { it.hasConfigFile(configFilePath) }
// hack for load extensions when compiler run directly from project directory (e.g. in tests)
?: File("compiler/cli/cli-common/resources").takeIf { it.hasConfigFile(configFilePath) }
?: configuration.get(CLIConfigurationKeys.PATH_TO_KOTLIN_COMPILER_JAR)?.takeIf { it.hasConfigFile(configFilePath) }
?: throw IllegalStateException(
"Unable to find extension point configuration $configFilePath " +
"(cp:\n ${(Thread.currentThread().contextClassLoader as? UrlClassLoader)?.urls?.joinToString("\n ") { it.file }})"