Add internal way to enable old backend

Needed for tests on debugger in Kotlin IDE plugin.
This commit is contained in:
Alexander Udalov
2022-09-23 20:36:37 +02:00
committed by Space
parent 7da7c4e0bb
commit 4a00d1f978
@@ -123,8 +123,9 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
} }
if (arguments.useOldBackend) { if (arguments.useOldBackend) {
messageCollector.report(ERROR, "-Xuse-old-backend is no longer supported. Please migrate to the new JVM IR backend") val severity = if (isUseOldBackendAllowed()) WARNING else ERROR
return COMPILATION_ERROR messageCollector.report(severity, "-Xuse-old-backend is no longer supported. Please migrate to the new JVM IR backend")
if (severity == ERROR) return COMPILATION_ERROR
} }
messageCollector.report(LOGGING, "Configuring the compilation environment") messageCollector.report(LOGGING, "Configuring the compilation environment")
@@ -260,6 +261,9 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
val argument = arguments.profileCompilerCommand ?: return defaultPerformanceManager val argument = arguments.profileCompilerCommand ?: return defaultPerformanceManager
return ProfilingCompilerPerformanceManager.create(argument) return ProfilingCompilerPerformanceManager.create(argument)
} }
private fun isUseOldBackendAllowed(): Boolean =
K2JVMCompiler::class.java.classLoader.getResource("META-INF/unsafe-allow-use-old-backend") != null
} }
fun CompilerConfiguration.configureModuleChunk( fun CompilerConfiguration.configureModuleChunk(