Language version 2.0: fix compiler messages and minor details
This commit is contained in:
@@ -175,15 +175,15 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
|||||||
|
|
||||||
ExitCode exitCode = OK;
|
ExitCode exitCode = OK;
|
||||||
|
|
||||||
LanguageVersionSettings languageVersionSettings = CommonConfigurationKeysKt.getLanguageVersionSettings(configuration);
|
boolean useFir = Boolean.TRUE.equals(configuration.get(CommonConfigurationKeys.USE_FIR));
|
||||||
LanguageVersion languageVersion = languageVersionSettings.getLanguageVersion();
|
if (K2JSCompilerArgumentsKt.isIrBackendEnabled(arguments) || useFir) {
|
||||||
if (K2JSCompilerArgumentsKt.isIrBackendEnabled(arguments) || languageVersion.getUsesK2()) {
|
|
||||||
exitCode = getIrCompiler().doExecute(arguments, configuration.copy(), rootDisposable, paths);
|
exitCode = getIrCompiler().doExecute(arguments, configuration.copy(), rootDisposable, paths);
|
||||||
}
|
}
|
||||||
if (K2JSCompilerArgumentsKt.isPreIrBackendDisabled(arguments) || languageVersion.getUsesK2()) {
|
if (K2JSCompilerArgumentsKt.isPreIrBackendDisabled(arguments) || useFir) {
|
||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LanguageVersionSettings languageVersionSettings = CommonConfigurationKeysKt.getLanguageVersionSettings(configuration);
|
||||||
|
|
||||||
if (CompilerSystemProperties.KOTLIN_JS_COMPILER_LEGACY_FORCE_ENABLED.getValue() != "true" && languageVersionSettings.getLanguageVersion().compareTo(LanguageVersion.KOTLIN_1_9) >= 0) {
|
if (CompilerSystemProperties.KOTLIN_JS_COMPILER_LEGACY_FORCE_ENABLED.getValue() != "true" && 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);
|
messageCollector.report(ERROR, "Old Kotlin/JS compiler is no longer supported. Please migrate to the new JS IR backend", null);
|
||||||
|
|||||||
@@ -104,19 +104,19 @@ abstract class CLICompiler<A : CommonCompilerArguments> : CLITool<A>() {
|
|||||||
arguments.languageVersion == null -> {
|
arguments.languageVersion == null -> {
|
||||||
messageCollector.report(
|
messageCollector.report(
|
||||||
STRONG_WARNING,
|
STRONG_WARNING,
|
||||||
"Compiler flag -Xuse-k2 is deprecated, please use -language-version 2.0 instead"
|
"Compiler flag -Xuse-k2 is deprecated, please use \"-language-version 2.0\" instead"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
languageVersion.usesK2 -> {
|
languageVersion.usesK2 -> {
|
||||||
messageCollector.report(
|
messageCollector.report(
|
||||||
STRONG_WARNING,
|
STRONG_WARNING,
|
||||||
"Compiler flag -Xuse-k2 is redundant"
|
"Compiler flag -Xuse-k2 is redundant, the \"-language-version 2.0\" is used instead"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
messageCollector.report(
|
messageCollector.report(
|
||||||
STRONG_WARNING,
|
STRONG_WARNING,
|
||||||
"With -Xuse-k2 compiler flag -language-version $languageVersion has no effect, please remove -Xuse-k2 flag or use -language-version 2.0 instead"
|
"With -Xuse-k2 compiler flag \"-language-version $languageVersion\" has no effect, please remove -Xuse-k2 flag and use \"-language-version 2.0\" instead"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,7 +202,8 @@ abstract class CLICompiler<A : CommonCompilerArguments> : CLITool<A>() {
|
|||||||
val pluginConfigurations = arguments.pluginConfigurations.orEmpty().toMutableList()
|
val pluginConfigurations = arguments.pluginConfigurations.orEmpty().toMutableList()
|
||||||
val messageCollector = configuration.getNotNull(MESSAGE_COLLECTOR_KEY)
|
val messageCollector = configuration.getNotNull(MESSAGE_COLLECTOR_KEY)
|
||||||
|
|
||||||
if (!checkPluginsArguments(messageCollector, arguments.useK2, pluginClasspaths, pluginOptions, pluginConfigurations)) {
|
val useK2 = configuration.get(CommonConfigurationKeys.USE_FIR) == true
|
||||||
|
if (!checkPluginsArguments(messageCollector, useK2, pluginClasspaths, pluginOptions, pluginConfigurations)) {
|
||||||
return INTERNAL_ERROR
|
return INTERNAL_ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,7 +275,7 @@ fun checkPluginsArguments(
|
|||||||
hasErrors = true
|
hasErrors = true
|
||||||
messageCollector.report(
|
messageCollector.report(
|
||||||
ERROR,
|
ERROR,
|
||||||
"-Xcompiler-plugin argument is allowed only for for K2 compiler. Please use -Xplugin argument or enable -Xuse-k2"
|
"-Xcompiler-plugin argument is allowed only for language version 2.0. Please use -Xplugin argument for language version 1.9 and below"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (pluginClasspaths.isNotEmpty() || pluginOptions.isNotEmpty()) {
|
if (pluginClasspaths.isNotEmpty() || pluginOptions.isNotEmpty()) {
|
||||||
|
|||||||
+1
-1
@@ -86,7 +86,7 @@ object FirKotlinToJvmBytecodeCompiler {
|
|||||||
"""
|
"""
|
||||||
|There are some plugins incompatible with language version 2.0:
|
|There are some plugins incompatible with language version 2.0:
|
||||||
|${notSupportedPlugins.joinToString(separator = "\n|") { " $it" }}
|
|${notSupportedPlugins.joinToString(separator = "\n|") { " $it" }}
|
||||||
|Please use language version 1.* (e.g. 1.9)
|
|Please use language version 1.9 or below
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class K2MetadataCompiler : CLICompiler<K2MetadataCompilerArguments>() {
|
|||||||
): ExitCode {
|
): ExitCode {
|
||||||
val collector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
|
val collector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
|
||||||
if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) {
|
if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) {
|
||||||
collector.report(ERROR, "Compilation to metadata is not supported in language version 2.0 right now")
|
collector.report(ERROR, "Compilation to metadata is not supported with language version 2.0 right now")
|
||||||
return ExitCode.COMPILATION_ERROR
|
return ExitCode.COMPILATION_ERROR
|
||||||
}
|
}
|
||||||
val performanceManager = configuration.getNotNull(CLIConfigurationKeys.PERF_MANAGER)
|
val performanceManager = configuration.getNotNull(CLIConfigurationKeys.PERF_MANAGER)
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
warning: compiler flag -Xuse-k2 is deprecated, please use -language-version 2.0 instead
|
warning: compiler flag -Xuse-k2 is deprecated, please use "-language-version 2.0" instead
|
||||||
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||||
OK
|
OK
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
warning: compiler flag -Xuse-k2 is redundant
|
warning: compiler flag -Xuse-k2 is redundant, the "-language-version 2.0" is used instead
|
||||||
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||||
OK
|
OK
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
warning: with -Xuse-k2 compiler flag -language-version 1.5 has no effect, please remove -Xuse-k2 flag or use -language-version 2.0 instead
|
warning: with -Xuse-k2 compiler flag "-language-version 1.5" has no effect, please remove -Xuse-k2 flag and use "-language-version 2.0" instead
|
||||||
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||||
OK
|
OK
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||||
error: compilation to metadata is not supported in language version 2.0 right now
|
error: compilation to metadata is not supported with language version 2.0 right now
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
warning: compiler flag -Xuse-k2 is deprecated, please use -language-version 2.0 instead
|
warning: compiler flag -Xuse-k2 is deprecated, please use "-language-version 2.0" instead
|
||||||
OK
|
OK
|
||||||
|
|||||||
@@ -58,9 +58,6 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
|||||||
if (pluginLoadResult != ExitCode.OK) return pluginLoadResult
|
if (pluginLoadResult != ExitCode.OK) return pluginLoadResult
|
||||||
|
|
||||||
val messageCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) ?: MessageCollector.NONE
|
val messageCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) ?: MessageCollector.NONE
|
||||||
if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) {
|
|
||||||
messageCollector.report(WARNING, "New compiler pipeline K2 is experimental in Kotlin/Native. No compatibility guarantees are yet provided")
|
|
||||||
}
|
|
||||||
|
|
||||||
val enoughArguments = arguments.freeArgs.isNotEmpty() || arguments.isUsefulWithoutFreeArgs
|
val enoughArguments = arguments.freeArgs.isNotEmpty() || arguments.isUsefulWithoutFreeArgs
|
||||||
if (!enoughArguments) {
|
if (!enoughArguments) {
|
||||||
|
|||||||
+1
-1
@@ -146,7 +146,7 @@ private val apiVersionValues = ApiVersion.run {
|
|||||||
KOTLIN_1_7,
|
KOTLIN_1_7,
|
||||||
KOTLIN_1_8,
|
KOTLIN_1_8,
|
||||||
KOTLIN_1_9,
|
KOTLIN_1_9,
|
||||||
KOTLIN_2_0
|
KOTLIN_2_0,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class Kapt3CommandLineProcessor : CommandLineProcessor {
|
|||||||
if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) {
|
if (configuration.getBoolean(CommonConfigurationKeys.USE_FIR)) {
|
||||||
configuration[CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY]?.report(
|
configuration[CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY]?.report(
|
||||||
CompilerMessageSeverity.ERROR,
|
CompilerMessageSeverity.ERROR,
|
||||||
"kapt currently doesn't support language version 2.0\nPlease use language version 1.* (e.g. 1.9) instead"
|
"kapt currently doesn't support language version 2.0\nPlease use language version 1.9 or below"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user