Add builtins_platform property to klib manifest

This commit is contained in:
Dmitry Savvinov
2020-02-19 18:55:52 +03:00
parent 8fcd98639d
commit b8b1dd753c
5 changed files with 27 additions and 6 deletions
@@ -15,6 +15,7 @@ const val KLIB_PROPERTY_DEPENDS = "depends"
const val KLIB_PROPERTY_PACKAGE = "package"
const val KLIB_PROPERTY_INTEROP = "interop"
const val KLIB_PROPERTY_EXPORT_FORWARD_DECLARATIONS = "exportForwardDeclarations"
const val KLIB_PROPERTY_BUILTINS_PLATFORM = "builtins_platform"
/**
* Abstractions for getting access to the information stored inside of Kotlin/Native library.
@@ -22,6 +22,7 @@ open class BaseWriterImpl(
val libraryLayout: KotlinLibraryLayoutForWriter,
moduleName: String,
override val versions: KotlinLibraryVersioning,
builtInsPlatform: BuiltInsPlatform,
val nopack: Boolean = false
) : BaseWriter {
@@ -37,6 +38,8 @@ open class BaseWriterImpl(
// TODO: <name>:<hash> will go somewhere around here.
manifestProperties.setProperty(KLIB_PROPERTY_UNIQUE_NAME, moduleName)
manifestProperties.writeKonanLibraryVersioning(versions)
if (builtInsPlatform != BuiltInsPlatform.COMMON)
manifestProperties.setProperty(KLIB_PROPERTY_BUILTINS_PLATFORM, builtInsPlatform.name)
}
override fun addLinkDependencies(libraries: List<KotlinLibrary>) {
@@ -78,11 +81,12 @@ class KoltinLibraryWriterImpl(
libDir: File,
moduleName: String,
versions: KotlinLibraryVersioning,
builtInsPlatform: BuiltInsPlatform,
nopack: Boolean = false,
val layout: KotlinLibraryLayoutForWriter = KotlinLibraryLayoutForWriter(libDir),
val base: BaseWriter = BaseWriterImpl(layout, moduleName, versions, nopack),
val base: BaseWriter = BaseWriterImpl(layout, moduleName, versions, builtInsPlatform, nopack),
metadata: MetadataWriter = MetadataWriterImpl(layout),
ir: IrWriter = IrMonoliticWriterImpl(layout)
// ir: IrWriter = IrPerFileWriterImpl(layout)
@@ -98,10 +102,11 @@ fun buildKoltinLibrary(
moduleName: String,
nopack: Boolean,
manifestProperties: Properties?,
dataFlowGraph: ByteArray?
dataFlowGraph: ByteArray?,
builtInsPlatform: BuiltInsPlatform
): KotlinLibraryLayout {
val library = KoltinLibraryWriterImpl(File(output), moduleName, versions, nopack)
val library = KoltinLibraryWriterImpl(File(output), moduleName, versions, builtInsPlatform, nopack)
library.addMetadata(metadata)
@@ -115,4 +120,8 @@ fun buildKoltinLibrary(
library.commit()
return library.layout
}
enum class BuiltInsPlatform {
JVM, JS, NATIVE, COMMON
}