[JS] Don't produce metadata-only (IR-less) KLIBs in JS

The scenario when JS source code is shared between a few JS common
source sets is not supported in Kotlin Multiplatform.

^KT-61136
This commit is contained in:
Dmitriy Dolovov
2023-09-15 15:08:43 +02:00
committed by Space Team
parent 9a2eff6487
commit a2e148173d
4 changed files with 9 additions and 8 deletions
@@ -25,9 +25,15 @@ class KlibMetadataIncrementalSerializer(
metadataVersion: KlibMetadataVersion,
project: Project,
exportKDoc: Boolean,
skipExpects: Boolean,
allowErrorTypes: Boolean = false
) : KlibMetadataSerializer(languageVersionSettings, metadataVersion, project, exportKDoc, skipExpects, allowErrorTypes = allowErrorTypes) {
) : KlibMetadataSerializer(
languageVersionSettings = languageVersionSettings,
metadataVersion = metadataVersion,
project = project,
exportKDoc = exportKDoc,
skipExpects = true, // Incremental compilation is not supposed to work when producing pure metadata (IR-less) KLIBs.
allowErrorTypes = allowErrorTypes
) {
fun serializePackageFragment(
module: ModuleDescriptor,
@@ -34,7 +34,7 @@ abstract class KlibMetadataSerializer(
val metadataVersion: BinaryVersion,
val project: Project?,
val exportKDoc: Boolean = false,
val skipExpects: Boolean = false,
val skipExpects: Boolean,
val includeOnlyModuleContent: Boolean = false,
private val allowErrorTypes: Boolean,
val produceHeaderKlib: Boolean = false,
@@ -98,9 +98,6 @@ val KotlinLibrary.serializedKlibFingerprint: SerializedKlibFingerprint?
private val CompilerConfiguration.metadataVersion
get() = get(CommonConfigurationKeys.METADATA_VERSION) as? KlibMetadataVersion ?: KlibMetadataVersion.INSTANCE
private val CompilerConfiguration.expectActualLinker: Boolean
get() = get(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER) ?: false
private val SerializedIrFile.fileMetadata: ByteArray
get() = backendSpecificMetadata ?: error("Expect file caches to have backendSpecificMetadata, but '$path' doesn't")
@@ -838,7 +835,6 @@ fun KlibMetadataIncrementalSerializer(configuration: CompilerConfiguration, proj
metadataVersion = configuration.metadataVersion,
project = project,
exportKDoc = false,
skipExpects = !configuration.expectActualLinker,
allowErrorTypes = allowErrors
)
@@ -122,7 +122,6 @@ abstract class AbstractKlibIrTextTestCase : CodegenTestCase() {
metadataVersion = KlibMetadataVersion.INSTANCE,
project = project,
exportKDoc = false,
skipExpects = true,
allowErrorTypes = allowErrors
)