[K/JS] Add a secret system property to enable the old Kotlin/JS compiler only for tests until it will be removed from the sources

This commit is contained in:
Artem Kobzar
2022-12-29 13:32:01 +00:00
committed by Space Team
parent 47f32b715f
commit fbf06b5495
49 changed files with 109 additions and 16 deletions
@@ -286,13 +286,20 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir {
}
protected void doJsTest(@NotNull String fileName) {
setupOldJsCompiler(fileName);
doTest(fileName, new K2JSCompiler());
}
protected void doJsDceTest(@NotNull String fileName) {
setupOldJsCompiler(fileName);
doTest(fileName, new K2JSDce());
}
private void setupOldJsCompiler(String fileName) {
if (fileName == null) return;
CompilerSystemProperties.KOTLIN_JS_COMPILER_LEGACY_FORCE_ENABLED.setValue(Boolean.toString(!fileName.contains("_strict")));
}
protected void doMetadataTest(@NotNull String fileName) {
doTest(fileName, new K2MetadataCompiler());
}
@@ -20,6 +20,7 @@ import com.intellij.openapi.util.io.FileUtil
import com.intellij.util.io.ZipUtil
import org.jetbrains.kotlin.cli.AbstractCliTest
import org.jetbrains.kotlin.cli.common.CLICompiler
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.cli.js.K2JSCompiler
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
@@ -167,6 +168,8 @@ abstract class AbstractKotlinCompilerIntegrationTest : TestCaseWithTmpdir() {
args.add("-output")
args.add(output.path)
args.add("-meta-info")
// TODO: It will be deleted after all of our internal vendors will use the new Kotlin/JS compiler
CompilerSystemProperties.KOTLIN_JS_COMPILER_LEGACY_FORCE_ENABLED.value = "true"
} else if (compiler is K2JVMCompiler || compiler is K2MetadataCompiler) {
if (classpath.isNotEmpty()) {
args.add("-classpath")