[KLIB] Deprecate -Xexpect-actual-linker CLI argument

This argument has been finally superseded by `-Xmetadata-klib`.

^KT-61136
This commit is contained in:
Dmitriy Dolovov
2023-09-15 19:56:00 +02:00
committed by Space Team
parent 620c9434ca
commit 78a962f6d2
13 changed files with 218 additions and 40 deletions
@@ -32,7 +32,6 @@ fun copyCommonCompilerArguments(from: CommonCompilerArguments, to: CommonCompile
to.enableBuilderInference = from.enableBuilderInference
to.enableSignatureClashChecks = from.enableSignatureClashChecks
to.expectActualClasses = from.expectActualClasses
to.expectActualLinker = from.expectActualLinker
to.experimental = from.experimental?.copyOf()
to.explicitApi = from.explicitApi
to.extendedCompilerChecks = from.extendedCompilerChecks
@@ -574,7 +574,8 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
@Argument(
value = "-Xmetadata-klib",
description = "Produce a klib that only contains the declarations metadata"
description = "Produce a klib that only contains the declarations metadata",
deprecatedName = "-Xexpect-actual-linker"
)
var metadataKlib: Boolean = false
set(value) {
@@ -582,17 +583,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
field = value
}
/** TODO: replace by [metadataKlib] */
@Argument(
value = "-Xexpect-actual-linker",
description = "Enable experimental expect/actual linker"
)
var expectActualLinker = false
set(value) {
checkFrozen()
field = value
}
@Argument(value = "-Xdisable-default-scripting-plugin", description = "Do not enable scripting plugin by default")
var disableDefaultScriptingPlugin = false
set(value) {
@@ -818,7 +808,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
}
put(AnalysisFlags.optIn, useExperimentalFqNames + optIn?.toList().orEmpty())
put(AnalysisFlags.skipExpectedActualDeclarationChecker, expectActualLinker || metadataKlib) // TODO (KT-61136): drop `expectActualLinker` later, after the appropriate changes in the Gradle plugin
put(AnalysisFlags.skipExpectedActualDeclarationChecker, metadataKlib)
put(AnalysisFlags.explicitApiVersion, apiVersion != null)
put(AnalysisFlags.allowResultReturnType, allowResultReturnType)
ExplicitApiMode.fromString(explicitApi)?.also { put(AnalysisFlags.explicitApiMode, it) } ?: collector.report(
@@ -28,7 +28,6 @@ fun CompilerConfiguration.setupCommonArguments(
put(CommonConfigurationKeys.DISABLE_INLINE, arguments.noInline)
put(CommonConfigurationKeys.USE_FIR_EXTENDED_CHECKERS, arguments.useFirExtendedCheckers)
put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, arguments.expectActualLinker)
put(CommonConfigurationKeys.METADATA_KLIB, arguments.metadataKlib)
putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot)
put(CommonConfigurationKeys.REPORT_OUTPUT_FILES, arguments.reportOutputFiles)
@@ -101,8 +101,7 @@ class K2MetadataCompiler : CLICompiler<K2MetadataCompilerArguments>() {
val environment =
KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.METADATA_CONFIG_FILES)
// TODO (KT-61136): drop `expectActualLinker` later, after the appropriate changes in the Gradle plugin
val mode = if (arguments.expectActualLinker || arguments.metadataKlib) "KLib" else "metadata"
val mode = if (arguments.metadataKlib) "KLib" else "metadata"
val sourceFiles = environment.getSourceFiles()
performanceManager.notifyCompilerInitialized(sourceFiles.size, environment.countLinesOfCode(sourceFiles), "$mode mode for $moduleName module")
@@ -121,8 +120,7 @@ class K2MetadataCompiler : CLICompiler<K2MetadataCompilerArguments>() {
val useFir = configuration.getBoolean(CommonConfigurationKeys.USE_FIR)
val metadataSerializer = when {
useFir -> FirMetadataSerializer(configuration, environment)
// TODO (KT-61136): drop `expectActualLinker` later, after the appropriate changes in the Gradle plugin
arguments.expectActualLinker || arguments.metadataKlib -> K2MetadataKlibSerializer(configuration, environment)
arguments.metadataKlib -> K2MetadataKlibSerializer(configuration, environment)
else -> MetadataSerializer(configuration, environment, dependOnOldBuiltIns = true)
}
metadataSerializer.analyzeAndSerialize()