Revert "[K/N] add flag to klib manifest for header klibs"
This reverts commit 59f0c0464b.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
+3
-11
@@ -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<PhaseContext, KlibWriterInput>(
|
||||
"WriteKlib", "Write klib output",
|
||||
@@ -46,11 +43,7 @@ internal val WriteKlibPhase = createSimpleNamedCompilerPhase<PhaseContext, KlibW
|
||||
metadataVersion = metadataVersion,
|
||||
)
|
||||
val target = config.target
|
||||
val manifestProperties = config.manifestProperties ?: Properties()
|
||||
|
||||
if (input.produceHeaderKlib) {
|
||||
manifestProperties.setProperty(KLIB_PROPERTY_HEADER, "true")
|
||||
}
|
||||
val manifestProperties = config.manifestProperties
|
||||
|
||||
if (!nopack) {
|
||||
val suffix = outputFiles.produce.suffix(target)
|
||||
@@ -87,7 +80,6 @@ internal val WriteKlibPhase = createSimpleNamedCompilerPhase<PhaseContext, KlibW
|
||||
internal fun <T : PhaseContext> PhaseEngine<T>.writeKlib(
|
||||
serializationOutput: SerializerOutput,
|
||||
customOutputPath: String? = null,
|
||||
produceHeaderKlib: Boolean = false,
|
||||
) {
|
||||
this.runPhase(WriteKlibPhase, KlibWriterInput(serializationOutput, customOutputPath, produceHeaderKlib))
|
||||
this.runPhase(WriteKlibPhase, KlibWriterInput(serializationOutput, customOutputPath))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user