[K/JS] Add flag for disabling signature uniqueness checks at klib generating phase
This commit is contained in:
+6
@@ -422,6 +422,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
|||||||
)
|
)
|
||||||
var normalizeAbsolutePath: Boolean by FreezableVar(false)
|
var normalizeAbsolutePath: Boolean by FreezableVar(false)
|
||||||
|
|
||||||
|
@Argument(
|
||||||
|
value = "-Xklib-enable-signature-clash-checks",
|
||||||
|
description = "Enable the checks on uniqueness of signatures"
|
||||||
|
)
|
||||||
|
var enableSignatureClashChecks: Boolean by FreezableVar(true)
|
||||||
|
|
||||||
@Argument(value = "-Xenable-incremental-compilation", description = "Enable incremental compilation")
|
@Argument(value = "-Xenable-incremental-compilation", description = "Enable incremental compilation")
|
||||||
var incrementalCompilation: Boolean? by FreezableVar(null)
|
var incrementalCompilation: Boolean? by FreezableVar(null)
|
||||||
|
|
||||||
|
|||||||
@@ -216,6 +216,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configuration.put(CommonConfigurationKeys.KLIB_NORMALIZE_ABSOLUTE_PATH, arguments.normalizeAbsolutePath)
|
configuration.put(CommonConfigurationKeys.KLIB_NORMALIZE_ABSOLUTE_PATH, arguments.normalizeAbsolutePath)
|
||||||
|
configuration.put(CommonConfigurationKeys.PRODUCE_KLIB_SIGNATURES_CLASH_CHECKS, arguments.enableSignatureClashChecks)
|
||||||
|
|
||||||
val environmentForJS =
|
val environmentForJS =
|
||||||
KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JS_CONFIG_FILES)
|
KotlinCoreEnvironment.createForProduction(rootDisposable, configuration, EnvironmentConfigFiles.JS_CONFIG_FILES)
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ object CommonConfigurationKeys {
|
|||||||
val KLIB_NORMALIZE_ABSOLUTE_PATH =
|
val KLIB_NORMALIZE_ABSOLUTE_PATH =
|
||||||
CompilerConfigurationKey.create<Boolean>("Normalize absolute paths in klib (replace file separator with '/')")
|
CompilerConfigurationKey.create<Boolean>("Normalize absolute paths in klib (replace file separator with '/')")
|
||||||
|
|
||||||
|
@JvmField
|
||||||
|
val PRODUCE_KLIB_SIGNATURES_CLASH_CHECKS =
|
||||||
|
CompilerConfigurationKey.create<Boolean>("Turn on the checks on uniqueness of signatures")
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
val INCREMENTAL_COMPILATION =
|
val INCREMENTAL_COMPILATION =
|
||||||
CompilerConfigurationKey.create<Boolean>("Enable incremental compilation")
|
CompilerConfigurationKey.create<Boolean>("Enable incremental compilation")
|
||||||
|
|||||||
@@ -734,6 +734,7 @@ fun serializeModuleIntoKlib(
|
|||||||
val compatibilityMode = CompatibilityMode(abiVersion)
|
val compatibilityMode = CompatibilityMode(abiVersion)
|
||||||
val sourceBaseDirs = configuration[CommonConfigurationKeys.KLIB_RELATIVE_PATH_BASES] ?: emptyList()
|
val sourceBaseDirs = configuration[CommonConfigurationKeys.KLIB_RELATIVE_PATH_BASES] ?: emptyList()
|
||||||
val absolutePathNormalization = configuration[CommonConfigurationKeys.KLIB_NORMALIZE_ABSOLUTE_PATH] ?: false
|
val absolutePathNormalization = configuration[CommonConfigurationKeys.KLIB_NORMALIZE_ABSOLUTE_PATH] ?: false
|
||||||
|
val signatureClashChecks = configuration[CommonConfigurationKeys.PRODUCE_KLIB_SIGNATURES_CLASH_CHECKS] ?: false
|
||||||
|
|
||||||
val serializedIr =
|
val serializedIr =
|
||||||
JsIrModuleSerializer(
|
JsIrModuleSerializer(
|
||||||
@@ -743,7 +744,8 @@ fun serializeModuleIntoKlib(
|
|||||||
compatibilityMode,
|
compatibilityMode,
|
||||||
skipExpects = !configuration.expectActualLinker,
|
skipExpects = !configuration.expectActualLinker,
|
||||||
normalizeAbsolutePaths = absolutePathNormalization,
|
normalizeAbsolutePaths = absolutePathNormalization,
|
||||||
sourceBaseDirs = sourceBaseDirs
|
sourceBaseDirs = sourceBaseDirs,
|
||||||
|
signatureClashChecks
|
||||||
).serializedIrModule(moduleFragment)
|
).serializedIrModule(moduleFragment)
|
||||||
|
|
||||||
val moduleDescriptor = moduleFragment.descriptor
|
val moduleDescriptor = moduleFragment.descriptor
|
||||||
|
|||||||
+7
-2
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.CompatibilityMode
|
import org.jetbrains.kotlin.backend.common.serialization.CompatibilityMode
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.DeclarationTable
|
import org.jetbrains.kotlin.backend.common.serialization.DeclarationTable
|
||||||
|
import org.jetbrains.kotlin.backend.common.serialization.IdSignatureClashTracker
|
||||||
import org.jetbrains.kotlin.backend.common.serialization.IrModuleSerializer
|
import org.jetbrains.kotlin.backend.common.serialization.IrModuleSerializer
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||||
import org.jetbrains.kotlin.ir.IrBuiltIns
|
import org.jetbrains.kotlin.ir.IrBuiltIns
|
||||||
@@ -21,10 +22,14 @@ class JsIrModuleSerializer(
|
|||||||
compatibilityMode: CompatibilityMode,
|
compatibilityMode: CompatibilityMode,
|
||||||
val skipExpects: Boolean,
|
val skipExpects: Boolean,
|
||||||
normalizeAbsolutePaths: Boolean,
|
normalizeAbsolutePaths: Boolean,
|
||||||
sourceBaseDirs: Collection<String>
|
sourceBaseDirs: Collection<String>,
|
||||||
|
shouldCheckSignaturesOnUniqueness: Boolean = true
|
||||||
) : IrModuleSerializer<JsIrFileSerializer>(messageLogger, compatibilityMode, normalizeAbsolutePaths, sourceBaseDirs) {
|
) : IrModuleSerializer<JsIrFileSerializer>(messageLogger, compatibilityMode, normalizeAbsolutePaths, sourceBaseDirs) {
|
||||||
|
|
||||||
private val globalDeclarationTable = JsGlobalDeclarationTable(irBuiltIns)
|
private val globalDeclarationTable = JsGlobalDeclarationTable(
|
||||||
|
irBuiltIns,
|
||||||
|
if (shouldCheckSignaturesOnUniqueness) JsUniqIdClashTracker() else IdSignatureClashTracker.DEFAULT_TRACKER
|
||||||
|
)
|
||||||
|
|
||||||
override fun createSerializerForFile(file: IrFile): JsIrFileSerializer =
|
override fun createSerializerForFile(file: IrFile): JsIrFileSerializer =
|
||||||
JsIrFileSerializer(
|
JsIrFileSerializer(
|
||||||
|
|||||||
+2
@@ -73,6 +73,8 @@ where advanced options include:
|
|||||||
-Xeffect-system Enable experimental language feature: effect system
|
-Xeffect-system Enable experimental language feature: effect system
|
||||||
-Xenable-builder-inference Use the builder inference by default, for all calls with lambdas which can't be resolved without it.
|
-Xenable-builder-inference Use the builder inference by default, for all calls with lambdas which can't be resolved without it.
|
||||||
The corresponding calls' declarations may not be marked with @BuilderInference.
|
The corresponding calls' declarations may not be marked with @BuilderInference.
|
||||||
|
-Xklib-enable-signature-clash-checks
|
||||||
|
Enable the checks on uniqueness of signatures
|
||||||
-Xexpect-actual-linker Enable experimental expect/actual linker
|
-Xexpect-actual-linker Enable experimental expect/actual linker
|
||||||
-Xexplicit-api={strict|warning|disable}
|
-Xexplicit-api={strict|warning|disable}
|
||||||
Force compiler to report errors on all public API declarations without explicit visibility or return type.
|
Force compiler to report errors on all public API declarations without explicit visibility or return type.
|
||||||
|
|||||||
+2
@@ -178,6 +178,8 @@ where advanced options include:
|
|||||||
-Xeffect-system Enable experimental language feature: effect system
|
-Xeffect-system Enable experimental language feature: effect system
|
||||||
-Xenable-builder-inference Use the builder inference by default, for all calls with lambdas which can't be resolved without it.
|
-Xenable-builder-inference Use the builder inference by default, for all calls with lambdas which can't be resolved without it.
|
||||||
The corresponding calls' declarations may not be marked with @BuilderInference.
|
The corresponding calls' declarations may not be marked with @BuilderInference.
|
||||||
|
-Xklib-enable-signature-clash-checks
|
||||||
|
Enable the checks on uniqueness of signatures
|
||||||
-Xexpect-actual-linker Enable experimental expect/actual linker
|
-Xexpect-actual-linker Enable experimental expect/actual linker
|
||||||
-Xexplicit-api={strict|warning|disable}
|
-Xexplicit-api={strict|warning|disable}
|
||||||
Force compiler to report errors on all public API declarations without explicit visibility or return type.
|
Force compiler to report errors on all public API declarations without explicit visibility or return type.
|
||||||
|
|||||||
Reference in New Issue
Block a user