From a78d498e3662abbceca5bed73f1004c6c3627553 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Fri, 15 Mar 2024 17:31:46 +0100 Subject: [PATCH] Revert "[K/N] add flag to klib manifest for header klibs" This reverts commit 59f0c0464b122658ee2737e0a30537bf33d247f7. --- .../org/jetbrains/kotlin/library/KotlinLibrary.kt | 4 ---- .../backend/konan/driver/DynamicCompilerDriver.kt | 4 ++-- .../backend/konan/driver/phases/WriteKlib.kt | 14 +++----------- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/compiler/util-klib/src/org/jetbrains/kotlin/library/KotlinLibrary.kt b/compiler/util-klib/src/org/jetbrains/kotlin/library/KotlinLibrary.kt index 7cd781eb84d..4278f732437 100644 --- a/compiler/util-klib/src/org/jetbrains/kotlin/library/KotlinLibrary.kt +++ b/compiler/util-klib/src/org/jetbrains/kotlin/library/KotlinLibrary.kt @@ -31,7 +31,6 @@ const val KLIB_PROPERTY_CONTAINS_ERROR_CODE = "contains_error_code" // Native-specific: const val KLIB_PROPERTY_INTEROP = "interop" -const val KLIB_PROPERTY_HEADER = "header" const val KLIB_PROPERTY_EXPORT_FORWARD_DECLARATIONS = "exportForwardDeclarations" const val KLIB_PROPERTY_INCLUDED_FORWARD_DECLARATIONS = "includedForwardDeclarations" const val KLIB_PROPERTY_IR_PROVIDER = "ir_provider" @@ -127,9 +126,6 @@ interface KotlinLibrary : BaseKotlinLibrary, MetadataLibrary, IrLibrary val KotlinLibrary.isInterop: Boolean get() = manifestProperties.getProperty(KLIB_PROPERTY_INTEROP) == "true" -val KotlinLibrary.isHeader: Boolean - get() = manifestProperties.getProperty(KLIB_PROPERTY_HEADER) == "true" - val KotlinLibrary.packageFqName: String? get() = manifestProperties.getProperty(KLIB_PROPERTY_PACKAGE) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/DynamicCompilerDriver.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/DynamicCompilerDriver.kt index 21ac6d128ee..26ad6eb3680 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/DynamicCompilerDriver.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/DynamicCompilerDriver.kt @@ -118,7 +118,7 @@ internal class DynamicCompilerDriver : CompilerDriver() { val headerKlibPath = config.headerKlibPath if (!headerKlibPath.isNullOrEmpty()) { val headerKlib = engine.runFir2IrSerializer(FirSerializerInput(fir2IrOutput, produceHeaderKlib = true)) - engine.writeKlib(headerKlib, headerKlibPath, produceHeaderKlib = true) + engine.writeKlib(headerKlib, headerKlibPath) // Don't overwrite the header klib with the full klib and stop compilation here. // By providing the same path for both regular output and header klib we can skip emitting the full klib. if (File(config.outputPath).canonicalPath == File(headerKlibPath).canonicalPath) return null @@ -144,7 +144,7 @@ internal class DynamicCompilerDriver : CompilerDriver() { val headerKlibPath = config.headerKlibPath if (!headerKlibPath.isNullOrEmpty()) { val headerKlib = engine.runSerializer(frontendOutput.moduleDescriptor, psiToIrOutput, produceHeaderKlib = true) - engine.writeKlib(headerKlib, headerKlibPath, produceHeaderKlib = true) + engine.writeKlib(headerKlib, headerKlibPath) // Don't overwrite the header klib with the full klib and stop compilation here. // By providing the same path for both regular output and header klib we can skip emitting the full klib. if (File(config.outputPath).canonicalPath == File(headerKlibPath).canonicalPath) return null diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/phases/WriteKlib.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/phases/WriteKlib.kt index dd5a795260a..f62f45a090e 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/phases/WriteKlib.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/driver/phases/WriteKlib.kt @@ -12,17 +12,14 @@ import org.jetbrains.kotlin.backend.konan.driver.PhaseContext import org.jetbrains.kotlin.backend.konan.driver.PhaseEngine import org.jetbrains.kotlin.config.KotlinCompilerVersion import org.jetbrains.kotlin.konan.library.impl.buildLibrary -import org.jetbrains.kotlin.library.KLIB_PROPERTY_HEADER import org.jetbrains.kotlin.library.KotlinAbiVersion import org.jetbrains.kotlin.library.KotlinLibraryVersioning import org.jetbrains.kotlin.library.metadata.KlibMetadataVersion import org.jetbrains.kotlin.util.removeSuffixIfPresent -import java.util.* internal data class KlibWriterInput( val serializerOutput: SerializerOutput, - val customOutputPath: String?, - val produceHeaderKlib: Boolean + val customOutputPath: String? ) internal val WriteKlibPhase = createSimpleNamedCompilerPhase( "WriteKlib", "Write klib output", @@ -46,11 +43,7 @@ internal val WriteKlibPhase = createSimpleNamedCompilerPhase PhaseEngine.writeKlib( serializationOutput: SerializerOutput, customOutputPath: String? = null, - produceHeaderKlib: Boolean = false, ) { - this.runPhase(WriteKlibPhase, KlibWriterInput(serializationOutput, customOutputPath, produceHeaderKlib)) + this.runPhase(WriteKlibPhase, KlibWriterInput(serializationOutput, customOutputPath)) }