[K/JS] Remove an internal system property and replace it with the new compiler flag

This commit is contained in:
Artem Kobzar
2023-03-17 12:38:34 +00:00
committed by Space Team
parent ca2492e1f8
commit 4da81b2b6e
164 changed files with 100 additions and 566 deletions
@@ -55,8 +55,7 @@ enum class CompilerSystemProperties(val property: String, val alwaysDirectAccess
USER_HOME("user.home", alwaysDirectAccess = true),
JAVA_VERSION("java.specification.version", alwaysDirectAccess = true),
JAVA_HOME("java.home", alwaysDirectAccess = true),
JAVA_CLASS_PATH("java.class.path", alwaysDirectAccess = true),
KOTLIN_JS_COMPILER_LEGACY_FORCE_ENABLED("kotlin.js.compiler.legacy.force_enabled", alwaysDirectAccess = true)
JAVA_CLASS_PATH("java.class.path", alwaysDirectAccess = true)
;
private fun <T> getProperFunction(custom: T?, default: T): T {
@@ -590,20 +590,10 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
}
@Argument(
value = "-Xuse-deprecated-legacy-compiler",
description = "Use deprecated legacy compiler without error"
value = "-Xforce-deprecated-legacy-compiler-usage",
description = "The flag is used only for our inner infrastructure. It will be removed soon, so it's unsafe to use it nowadays."
)
var useDeprecatedLegacyCompiler = false
set(value) {
checkFrozen()
field = value
}
@Argument(
value = "-Xlegacy-deprecated-no-warn",
description = "Disable warnings of deprecation of legacy compiler"
)
var legacyDeprecatedNoWarn = false
var forceDeprecatedLegacyCompilerUsage = false
set(value) {
checkFrozen()
field = value
@@ -623,11 +613,6 @@ 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 && CompilerSystemProperties.KOTLIN_JS_COMPILER_LEGACY_FORCE_ENABLED.value != "true") {
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
}
@@ -185,29 +185,12 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
}
LanguageVersionSettings languageVersionSettings = CommonConfigurationKeysKt.getLanguageVersionSettings(configuration);
if (!Objects.equals(CompilerSystemProperties.KOTLIN_JS_COMPILER_LEGACY_FORCE_ENABLED.getValue(), "true") && languageVersionSettings.getLanguageVersion().compareTo(LanguageVersion.KOTLIN_1_9) >= 0) {
if (!arguments.getForceDeprecatedLegacyCompilerUsage() && 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" +
"Please migrate your project to the new IR-based compiler (https://kotl.in/jsir).\n" +
"Because your build tool will not support the new Kotlin/JS compiler, you will also need to migrate to Gradle.\n" +
"\n" +
"You can continue to use the deprecated legacy compiler in the current version of the toolchain by providing the compiler option -Xuse-deprecated-legacy-compiler.\n" +
"==========";
if (!arguments.getUseDeprecatedLegacyCompiler()) {
messageCollector.report(ERROR, deprecatedMessage, null);
return COMPILATION_ERROR;
}
if (!arguments.getLegacyDeprecatedNoWarn()) {
messageCollector.report(STRONG_WARNING, deprecatedMessage, null);
}
if (arguments.getFreeArgs().isEmpty() && (!incrementalCompilationIsEnabledForJs(arguments))) {
if (arguments.getVersion()) {
return OK;