Renamed -Xklib-mpp to -Xexpect-actual-linker to reduce user confusion

This commit is contained in:
Alexander Gorshenev
2020-04-03 18:59:22 +03:00
committed by alexander-gorshenev
parent 86fd4da567
commit 97be5617ca
15 changed files with 33 additions and 33 deletions
@@ -321,10 +321,10 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
var useMixedNamedArguments: Boolean by FreezableVar(false)
@Argument(
value = "-Xklib-mpp",
description = "Enable experimental support for multi-platform klib libraries"
value = "-Xexpect-actual-linker",
description = "Enable experimental expect/actual linker"
)
var klibBasedMpp: Boolean by FreezableVar(false)
var expectActualLinker: Boolean by FreezableVar(false)
@Argument(value = "-Xdisable-default-scripting-plugin", description = "Do not enable scripting plugin by default")
var disableDefaultScriptingPlugin: Boolean by FreezableVar(false)
@@ -347,7 +347,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
collector.report(CompilerMessageSeverity.WARNING, "'-Xexperimental' is deprecated and will be removed in a future release")
}
put(AnalysisFlags.useExperimental, useExperimental?.toList().orEmpty() + optIn?.toList().orEmpty())
put(AnalysisFlags.klibBasedMpp, klibBasedMpp)
put(AnalysisFlags.expectActualLinker, expectActualLinker)
put(AnalysisFlags.explicitApiVersion, apiVersion != null)
put(AnalysisFlags.allowResultReturnType, allowResultReturnType)
ExplicitApiMode.fromString(explicitApi)?.also { put(AnalysisFlags.explicitApiMode, it) } ?: collector.report(
@@ -23,7 +23,7 @@ fun <A : CommonCompilerArguments> CompilerConfiguration.setupCommonArguments(
) {
put(CommonConfigurationKeys.DISABLE_INLINE, arguments.noInline)
put(CommonConfigurationKeys.USE_FIR, arguments.useFir)
put(CommonConfigurationKeys.KLIB_MPP, arguments.klibBasedMpp)
put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, arguments.expectActualLinker)
putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot)
put(CommonConfigurationKeys.REPORT_OUTPUT_FILES, arguments.reportOutputFiles)
@@ -118,4 +118,4 @@ private fun <A : CommonToolArguments> MessageCollector.reportUnsafeInternalArgum
"compiler or generated code. Use it at your own risk!\n"
)
}
}
}
@@ -106,7 +106,7 @@ class K2MetadataCompiler : CLICompiler<K2MetadataCompilerArguments>() {
try {
val metadataVersion =
configuration.get(CommonConfigurationKeys.METADATA_VERSION) as? BuiltInsBinaryVersion ?: BuiltInsBinaryVersion.INSTANCE
if (arguments.klibBasedMpp) {
if (arguments.expectActualLinker) {
K2MetadataKlibSerializer(metadataVersion).serialize(environment)
} else {
MetadataSerializer(metadataVersion, true).serialize(environment)
@@ -13,7 +13,7 @@ object AnalysisFlags {
val multiPlatformDoNotCheckActual by AnalysisFlag.Delegates.Boolean
@JvmStatic
val klibBasedMpp by AnalysisFlag.Delegates.Boolean
val expectActualLinker by AnalysisFlag.Delegates.Boolean
@JvmStatic
val experimental by AnalysisFlag.Delegates.ListOfStrings
@@ -46,7 +46,7 @@ object CommonConfigurationKeys {
val USE_FIR = CompilerConfigurationKey.create<Boolean>("front-end IR")
@JvmField
val KLIB_MPP = CompilerConfigurationKey.create<Boolean>("Klib based MPP")
val EXPECT_ACTUAL_LINKER = CompilerConfigurationKey.create<Boolean>("Experimental expext/actual linker")
}
var CompilerConfiguration.languageVersionSettings: LanguageVersionSettings
@@ -55,7 +55,7 @@ class ExpectedActualDeclarationChecker(
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
if (!context.languageVersionSettings.supportsFeature(LanguageFeature.MultiPlatformProjects)) return
// TODO: we need a klib based MPP aware ModuleStructureOracle. Just disable the checks for now.
if (context.languageVersionSettings.getFlag(AnalysisFlags.klibBasedMpp)) return
if (context.languageVersionSettings.getFlag(AnalysisFlags.expectActualLinker)) return
// Note that this check is necessary, because for default accessors KtProperty is passed for KtDeclaration, so this
// case won't be covered by the next check (also, it accidentally fixes KT-28385)
@@ -83,8 +83,8 @@ val emptyLoggingContext = object : LoggingContext {
private val CompilerConfiguration.metadataVersion
get() = get(CommonConfigurationKeys.METADATA_VERSION) as? KlibMetadataVersion ?: KlibMetadataVersion.INSTANCE
private val CompilerConfiguration.klibMpp: Boolean
get() = get(CommonConfigurationKeys.KLIB_MPP) ?: false
private val CompilerConfiguration.expectActualLinker: Boolean
get() = get(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER) ?: false
class KotlinFileSerializedData(val metadata: ByteArray, val irData: SerializedIrFile)
@@ -141,7 +141,7 @@ fun generateKLib(
val moduleName = configuration[CommonConfigurationKeys.MODULE_NAME]!!
if (!configuration.klibMpp) {
if (!configuration.expectActualLinker) {
moduleFragment.acceptVoid(ExpectDeclarationRemover(psi2IrContext.symbolTable, doRemove = false, keepOptionalAnnotations = false))
}
@@ -442,7 +442,7 @@ fun serializeModuleIntoKlib(
emptyLoggingContext,
moduleFragment.irBuiltins,
expectDescriptorToSymbol = expectDescriptorToSymbol,
skipExpects = !configuration.klibMpp
skipExpects = !configuration.expectActualLinker
).serializedIrModule(moduleFragment)
val moduleDescriptor = moduleFragment.descriptor
@@ -547,5 +547,5 @@ private fun compareMetadataAndGoToNextICRoundIfNeeded(
private fun KlibMetadataIncrementalSerializer(configuration: CompilerConfiguration) = KlibMetadataIncrementalSerializer(
languageVersionSettings = configuration.languageVersionSettings,
metadataVersion = configuration.metadataVersion,
skipExpects = !configuration.klibMpp
skipExpects = !configuration.expectActualLinker
)
+1 -1
View File
@@ -32,13 +32,13 @@ where advanced options include:
-Xdump-fqname FqName of declaration that should be dumped
-Xdump-perf=<path> Dump detailed performance statistics to the specified file
-Xeffect-system Enable experimental language feature: effect system
-Xexpect-actual-linker Enable experimental expect/actual linker
-Xexperimental=<fq.name> Enable and propagate usages of experimental API for marker annotation with the given fully qualified name
-Xexplicit-api={strict|warning|disable}
Force compiler to report errors on all public API declarations without explicit visibility or return type.
Use 'warning' level to issue warnings instead of errors.
-Xinline-classes Enable experimental inline classes
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
-Xklib-mpp Enable experimental support for multi-platform klib libraries
-Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block
-Xlist-phases List backend phases
-Xmetadata-version Change metadata version of the generated binary files
+1 -1
View File
@@ -92,13 +92,13 @@ where advanced options include:
-Xdump-fqname FqName of declaration that should be dumped
-Xdump-perf=<path> Dump detailed performance statistics to the specified file
-Xeffect-system Enable experimental language feature: effect system
-Xexpect-actual-linker Enable experimental expect/actual linker
-Xexperimental=<fq.name> Enable and propagate usages of experimental API for marker annotation with the given fully qualified name
-Xexplicit-api={strict|warning|disable}
Force compiler to report errors on all public API declarations without explicit visibility or return type.
Use 'warning' level to issue warnings instead of errors.
-Xinline-classes Enable experimental inline classes
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
-Xklib-mpp Enable experimental support for multi-platform klib libraries
-Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block
-Xlist-phases List backend phases
-Xmetadata-version Change metadata version of the generated binary files
@@ -1,6 +1,6 @@
// !LANGUAGE: +MultiPlatformProjects
// KJS_WITH_FULL_RUNTIME
// KLIB_BASED_MPP
// EXPECT_ACTUAL_LINKER
// IGNORE_BACKEND: JS
// IGNORE_BACKEND_FIR: JVM_IR
@@ -1,6 +1,6 @@
// !LANGUAGE: +MultiPlatformProjects
// KJS_WITH_FULL_RUNTIME
// KLIB_BASED_MPP
// EXPECT_ACTUAL_LINKER
// IGNORE_BACKEND: JS
// IGNORE_BACKEND_FIR: JVM_IR
@@ -1,6 +1,6 @@
// !LANGUAGE: +MultiPlatformProjects
// KJS_WITH_FULL_RUNTIME
// KLIB_BASED_MPP
// EXPECT_ACTUAL_LINKER
// IGNORE_BACKEND: JS
// IGNORE_BACKEND_FIR: JVM_IR
@@ -124,7 +124,7 @@ abstract class BasicBoxTest(
val runPlainBoxFunction = RUN_PLAIN_BOX_FUNCTION.matcher(fileContent).find()
val inferMainModule = INFER_MAIN_MODULE.matcher(fileContent).find()
val klibBasedMpp = KLIB_BASED_MPP.matcher(fileContent).find()
val expectActualLinker = EXPECT_ACTUAL_LINKER.matcher(fileContent).find()
val skipDceDriven = SKIP_DCE_DRIVEN.matcher(fileContent).find()
@@ -171,7 +171,7 @@ abstract class BasicBoxTest(
testFactory.tmpDir,
file.parent, module, outputFileName, dceOutputFileName, pirOutputFileName, dependencies, allDependencies, friends, modules.size > 1,
!SKIP_SOURCEMAP_REMAPPING.matcher(fileContent).find(), outputPrefixFile, outputPostfixFile,
actualMainCallParameters, testPackage, testFunction, needsFullIrRuntime, isMainModule, klibBasedMpp, skipDceDriven
actualMainCallParameters, testPackage, testFunction, needsFullIrRuntime, isMainModule, expectActualLinker, skipDceDriven
)
when {
@@ -383,7 +383,7 @@ abstract class BasicBoxTest(
testFunction: String,
needsFullIrRuntime: Boolean,
isMainModule: Boolean,
klibBasedMpp: Boolean,
expectActualLinker: Boolean,
skipDceDriven: Boolean
) {
val kotlinFiles = module.files.filter { it.fileName.endsWith(".kt") }
@@ -400,7 +400,7 @@ abstract class BasicBoxTest(
val psiFiles = createPsiFiles(allSourceFiles.sortedBy { it.canonicalPath }.map { it.canonicalPath })
val sourceDirs = (testFiles + additionalFiles).map { File(it).parent }.distinct()
val config = createConfig(sourceDirs, module, dependencies, allDependencies, friends, multiModule, tmpDir, incrementalData = null, klibBasedMpp = klibBasedMpp)
val config = createConfig(sourceDirs, module, dependencies, allDependencies, friends, multiModule, tmpDir, incrementalData = null, expectActualLinker = expectActualLinker)
val outputFile = File(outputFileName)
val dceOutputFile = File(dceOutputFileName)
val pirOutputFile = File(pirOutputFileName)
@@ -414,7 +414,7 @@ abstract class BasicBoxTest(
if (incrementalCompilationChecksEnabled && module.hasFilesToRecompile) {
checkIncrementalCompilation(
sourceDirs, module, kotlinFiles, dependencies, allDependencies, friends, multiModule, tmpDir, remap,
outputFile, outputPrefixFile, outputPostfixFile, mainCallParameters, incrementalData, testPackage, testFunction, needsFullIrRuntime, klibBasedMpp
outputFile, outputPrefixFile, outputPostfixFile, mainCallParameters, incrementalData, testPackage, testFunction, needsFullIrRuntime, expectActualLinker
)
}
}
@@ -437,7 +437,7 @@ abstract class BasicBoxTest(
testPackage: String?,
testFunction: String,
needsFullIrRuntime: Boolean,
klibBasedMpp: Boolean
expectActualLinker: Boolean
) {
val sourceToTranslationUnit = hashMapOf<File, TranslationUnit>()
for (testFile in kotlinFiles) {
@@ -455,7 +455,7 @@ abstract class BasicBoxTest(
.sortedBy { it.canonicalPath }
.map { sourceToTranslationUnit[it]!! }
val recompiledConfig = createConfig(sourceDirs, module, dependencies, allDependencies, friends, multiModule, tmpDir, incrementalData, klibBasedMpp)
val recompiledConfig = createConfig(sourceDirs, module, dependencies, allDependencies, friends, multiModule, tmpDir, incrementalData, expectActualLinker)
val recompiledOutputFile = File(outputFile.parentFile, outputFile.nameWithoutExtension + "-recompiled.js")
translateFiles(
@@ -670,7 +670,7 @@ abstract class BasicBoxTest(
private fun createConfig(
sourceDirs: List<String>, module: TestModule, dependencies: List<String>, allDependencies: List<String>, friends: List<String>,
multiModule: Boolean, tmpDir: File, incrementalData: IncrementalData?, klibBasedMpp: Boolean
multiModule: Boolean, tmpDir: File, incrementalData: IncrementalData?, expectActualLinker: Boolean
): JsConfig {
val configuration = environment.configuration.copy()
@@ -722,7 +722,7 @@ abstract class BasicBoxTest(
)
)
configuration.put(CommonConfigurationKeys.KLIB_MPP, klibBasedMpp)
configuration.put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, expectActualLinker)
return JsConfig(project, configuration, METADATA_CACHE, (JsConfig.JS_STDLIB + JsConfig.JS_KOTLIN_TEST).toSet())
}
@@ -915,7 +915,7 @@ abstract class BasicBoxTest(
private val SOURCE_MAP_SOURCE_EMBEDDING = Regex("^// *SOURCE_MAP_EMBED_SOURCES: ([A-Z]+)*\$", RegexOption.MULTILINE)
private val CALL_MAIN_PATTERN = Pattern.compile("^// *CALL_MAIN *$", Pattern.MULTILINE)
private val KJS_WITH_FULL_RUNTIME = Pattern.compile("^// *KJS_WITH_FULL_RUNTIME *\$", Pattern.MULTILINE)
private val KLIB_BASED_MPP = Pattern.compile("^// KLIB_BASED_MPP *$", Pattern.MULTILINE)
private val EXPECT_ACTUAL_LINKER = Pattern.compile("^// EXPECT_ACTUAL_LINKER *$", Pattern.MULTILINE)
private val SKIP_DCE_DRIVEN = Pattern.compile("^// *SKIP_DCE_DRIVEN *$", Pattern.MULTILINE)
@JvmStatic
@@ -250,7 +250,7 @@ abstract class AbstractKotlinNativeCompile<T : KotlinCommonToolOptions> : Abstra
addArg("-p", outputKind.name.toLowerCase())
if (compilation is KotlinSharedNativeCompilation) {
add("-Xklib-mpp")
add("-Xexpect-actual-linker")
add("-Xmetadata-klib")
}
@@ -60,7 +60,7 @@ open class KotlinCompileCommon : AbstractKotlinCompile<K2MetadataCompilerArgumen
args.moduleName = this@KotlinCompileCommon.moduleName
if ((taskData.compilation as? KotlinCommonCompilation)?.isKlibCompilation == true) {
args.klibBasedMpp = true
args.expectActualLinker = true
}
if (defaultsOnly) return
@@ -105,4 +105,4 @@ open class KotlinCompileCommon : AbstractKotlinCompile<K2MetadataCompilerArgumen
)
compilerRunner.runMetadataCompilerAsync(sourceRoots.kotlinSourceFiles, args, environment)
}
}
}