JVM IR: output stable ABI binaries by default
#KT-43592 Fixed
This commit is contained in:
+5
-3
@@ -103,8 +103,10 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(
|
||||
value = "-Xabi-stability",
|
||||
valueDescription = "{stable|unstable}",
|
||||
description = "When using unstable compiler features such as FIR or JVM IR, use 'stable' to mark generated class files as stable\n" +
|
||||
"to prevent diagnostics from stable compilers at the call site.\n"
|
||||
description = "When using unstable compiler features such as FIR, use 'stable' to mark generated class files as stable\n" +
|
||||
"to prevent diagnostics from stable compilers at the call site.\n" +
|
||||
"When using the JVM IR backend, conversely, use 'unstable' to mark generated class files as unstable\n" +
|
||||
"to force diagnostics to be reported."
|
||||
)
|
||||
var abiStability: String? by FreezableVar(null)
|
||||
|
||||
@@ -446,7 +448,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
result[JvmAnalysisFlags.suppressMissingBuiltinsError] = suppressMissingBuiltinsError
|
||||
result[JvmAnalysisFlags.irCheckLocalNames] = irCheckLocalNames
|
||||
result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview
|
||||
result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useIR || useFir
|
||||
result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useFir
|
||||
result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses
|
||||
return result
|
||||
}
|
||||
|
||||
+2
-2
@@ -182,10 +182,10 @@ class AnalyzerWithCompilerReport(
|
||||
)
|
||||
}
|
||||
|
||||
if (diagnostics.any { it.factory == Errors.IR_COMPILED_CLASS }) {
|
||||
if (diagnostics.any { it.factory == Errors.IR_WITH_UNSTABLE_ABI_COMPILED_CLASS }) {
|
||||
messageCollector.report(
|
||||
ERROR,
|
||||
"Classes compiled by a new Kotlin compiler backend were found in dependencies. " +
|
||||
"Classes compiled by an unstable version of the Kotlin compiler were found in dependencies. " +
|
||||
"Remove them from the classpath or use '-Xallow-unstable-dependencies' to suppress errors"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -165,7 +165,8 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
|
||||
|
||||
put(JVMConfigurationKeys.PARAMETERS_METADATA, arguments.javaParameters)
|
||||
|
||||
put(JVMConfigurationKeys.IR, (arguments.useIR && !arguments.noUseIR) || arguments.useFir)
|
||||
val useIR = (arguments.useIR && !arguments.noUseIR) || arguments.useFir
|
||||
put(JVMConfigurationKeys.IR, useIR)
|
||||
|
||||
val abiStability = JvmAbiStability.fromStringOrNull(arguments.abiStability)
|
||||
if (arguments.abiStability != null) {
|
||||
@@ -174,6 +175,8 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
|
||||
ERROR,
|
||||
"Unknown ABI stability mode: ${arguments.abiStability}, supported modes: ${JvmAbiStability.values().map { it.description }}"
|
||||
)
|
||||
} else if (!useIR && abiStability == JvmAbiStability.UNSTABLE) {
|
||||
messageCollector.report(ERROR, "-Xabi-stability=unstable is not supported in the old JVM backend")
|
||||
} else {
|
||||
put(JVMConfigurationKeys.ABI_STABILITY, abiStability)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user