[Gradle] Use new Usage 'kotlin-commonized-cinterop' to differentiate cinterop commonizer configurations

^KT-61376 Verification Pending
This commit is contained in:
Sebastian Sellmair
2023-08-22 14:06:25 +02:00
committed by Space Team
parent fc2b700784
commit a832510487
2 changed files with 15 additions and 3 deletions
@@ -20,7 +20,21 @@ object KotlinUsages {
const val KOTLIN_API = "kotlin-api"
const val KOTLIN_RUNTIME = "kotlin-runtime"
const val KOTLIN_METADATA = "kotlin-metadata"
/**
* Platform CInterop usage:
* These are CInterop files that represent executable .klibs for a given konan target
* ! NOTE !: This usage is compatible with [KOTLIN_API], [JAVA_API] and [JAVA_RUNTIME]
*/
const val KOTLIN_CINTEROP = "kotlin-cinterop"
/**
* Commonized CInterop usage:
* This CInterops are produced by the commonizer.
* ! Note !: This usage is intended only for project to project dependencies.
* Unlike [KOTLIN_CINTEROP] this usage is not marked compatible with [KOTLIN_API], [JAVA_API] or [JAVA_RUNTIME]
*/
const val KOTLIN_COMMONIZED_CINTEROP = "kotlin-commonized-cinterop"
const val KOTLIN_SOURCES = "kotlin-sources"
// Following two constants were removed in Gradle 8.0 from 'Usages' class
@@ -128,9 +128,7 @@ private fun Project.setupBasicCommonizedCInteropConfigurationAttributes(
configuration: Configuration,
commonizerTarget: SharedCommonizerTarget,
) {
configuration.attributes.attribute(KotlinPlatformType.attribute, KotlinPlatformType.native)
configuration.attributes.attribute(CommonizerTargetAttribute.attribute, commonizerTarget.identityString)
configuration.attributes.attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, cinteropKlibLibraryElements())
configuration.attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class.java, KotlinUsages.KOTLIN_CINTEROP))
configuration.attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class.java, KotlinUsages.KOTLIN_COMMONIZED_CINTEROP))
configuration.attributes.attribute(Category.CATEGORY_ATTRIBUTE, project.categoryByName(Category.LIBRARY))
}