[K/JS] Deprecate old JS-compiler

This commit is contained in:
Artem Kobzar
2022-11-23 11:22:29 +00:00
committed by Space Team
parent e42385dfb0
commit c1c5933c72
6 changed files with 35 additions and 6 deletions
@@ -362,6 +362,11 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
collector.deprecationWarn(irBaseClassInMetadata, false, "-Xir-base-class-in-metadata")
collector.deprecationWarn(irNewIr2Js, true, "-Xir-new-ir2js")
if (languageVersion >= LanguageVersion.KOTLIN_1_9) {
collector.deprecationWarn(legacyDeprecatedNoWarn, false, "-Xlegacy-deprecated-no-warn")
collector.deprecationWarn(useDeprecatedLegacyCompiler, false, "-Xuse-deprecated-legacy-compiler")
}
return super.configureAnalysisFlags(collector, languageVersion).also {
it[allowFullyQualifiedNameInKClass] = wasm && wasmKClassFqn //Only enabled WASM BE supports this flag
}
@@ -182,6 +182,13 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
return exitCode;
}
LanguageVersionSettings languageVersionSettings = CommonConfigurationKeysKt.getLanguageVersionSettings(configuration);
if (languageVersionSettings.getLanguageVersion().compareTo(LanguageVersion.KOTLIN_1_9) >= 0) {
messageCollector.report(ERROR, "Old Kotlin/JS compiler is no longer supported. Please migrate to the new JS IR backend", null);
return COMPILATION_ERROR;
}
String deprecatedMessage = "==========\n" +
"This project currently uses the Kotlin/JS Legacy compiler backend, which has been deprecated and will be removed in a future release.\n" +
"\n" +
+7
View File
@@ -0,0 +1,7 @@
$TESTDATA_DIR$/languageVersion.kt
-Xlegacy-deprecated-no-warn
-Xuse-deprecated-legacy-compiler
-output
$TEMP_DIR$/out.js
-language-version
1.9
+3
View File
@@ -0,0 +1,3 @@
warning: language version 1.9 is experimental, there are no backwards compatibility guarantees for new language and library features
error: old Kotlin/JS compiler is no longer supported. Please migrate to the new JS IR backend
COMPILATION_ERROR
@@ -1205,6 +1205,11 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/js/jsHelp.args");
}
@TestMetadata("jsOldBackend.args")
public void testJsOldBackend() throws Exception {
runTest("compiler/testData/cli/js/jsOldBackend.args");
}
@TestMetadata("kotlinHomeWithoutStdlib.args")
public void testKotlinHomeWithoutStdlib() throws Exception {
runTest("compiler/testData/cli/js/kotlinHomeWithoutStdlib.args");
@@ -294,17 +294,19 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
doTestPreReleaseKotlinLibrary(K2JVMCompiler(), "library", tmpdir)
}
fun testReleaseCompilerAgainstPreReleaseLibraryJs() {
doTestPreReleaseKotlinLibrary(K2JSCompiler(), "library", File(tmpdir, "usage.js"))
}
// https://youtrack.jetbrains.com/issue/KT-54905
// fun testReleaseCompilerAgainstPreReleaseLibraryJs() {
// doTestPreReleaseKotlinLibrary(K2JSCompiler(), "library", File(tmpdir, "usage.js"))
// }
fun testReleaseCompilerAgainstPreReleaseLibrarySkipPrereleaseCheck() {
doTestPreReleaseKotlinLibrary(K2JVMCompiler(), "library", tmpdir, "-Xskip-prerelease-check")
}
fun testReleaseCompilerAgainstPreReleaseLibraryJsSkipPrereleaseCheck() {
doTestPreReleaseKotlinLibrary(K2JSCompiler(), "library", File(tmpdir, "usage.js"), "-Xskip-prerelease-check")
}
// https://youtrack.jetbrains.com/issue/KT-54905
// fun testReleaseCompilerAgainstPreReleaseLibraryJsSkipPrereleaseCheck() {
// doTestPreReleaseKotlinLibrary(K2JSCompiler(), "library", File(tmpdir, "usage.js"), "-Xskip-prerelease-check")
// }
fun testReleaseCompilerAgainstPreReleaseLibrarySkipMetadataVersionCheck() {
doTestPreReleaseKotlinLibrary(K2JVMCompiler(), "library", tmpdir, "-Xskip-metadata-version-check")