[Commonizer] Add 'commonizer_target' and 'commonizer_native_targets' to commonized klib's manifest

^KT-46077 Fixed
This commit is contained in:
sebastian.sellmair
2021-04-14 13:58:10 +02:00
committed by Space
parent 6f96c225d7
commit bbcfde7231
13 changed files with 147 additions and 99 deletions
@@ -22,6 +22,19 @@ const val KLIB_PROPERTY_INTEROP = "interop"
const val KLIB_PROPERTY_EXPORT_FORWARD_DECLARATIONS = "exportForwardDeclarations"
const val KLIB_PROPERTY_NATIVE_TARGETS = "native_targets"
// Commonizer-specific:
/**
* Identity String of the commonizer target representing this artifact.
* This will also include native targets that were absent during commonization
*/
const val KLIB_PROPERTY_COMMONIZER_TARGET = "commonizer_target"
/**
* Similar to [KLIB_PROPERTY_NATIVE_TARGETS] but this will also preserve targets
* that were unsupported on the host creating this artifact
*/
const val KLIB_PROPERTY_COMMONIZER_NATIVE_TARGETS = "commonizer_native_targets"
/**
* Abstractions for getting access to the information stored inside of Kotlin/Native library.
*/
@@ -31,6 +44,7 @@ interface BaseKotlinLibrary {
val libraryFile: File
val componentList: List<String>
val versions: KotlinLibraryVersioning
// Whether this library is default (provided by distribution)?
val isDefault: Boolean
val manifestProperties: Properties
@@ -80,4 +94,12 @@ val BaseKotlinLibrary.nativeTargets: List<String>
get() = manifestProperties.propertyList(KLIB_PROPERTY_NATIVE_TARGETS)
val KotlinLibrary.containsErrorCode: Boolean
get() = manifestProperties.getProperty(KLIB_PROPERTY_CONTAINS_ERROR_CODE) == "true"
get() = manifestProperties.getProperty(KLIB_PROPERTY_CONTAINS_ERROR_CODE) == "true"
val KotlinLibrary.commonizerTarget: String?
get() = manifestProperties.getProperty(KLIB_PROPERTY_COMMONIZER_TARGET)
val KotlinLibrary.commonizerNativeTargets: List<String>?
get() = if (manifestProperties.containsKey(KLIB_PROPERTY_COMMONIZER_NATIVE_TARGETS))
manifestProperties.propertyList(KLIB_PROPERTY_COMMONIZER_NATIVE_TARGETS, escapeInQuotes = true)
else null