KPM: In Native variants, expose the implementation dependencies as API
This simulates the behavior of the stable plugin which also exposes the implementation dependencies in the Native targets.
This commit is contained in:
+3
@@ -47,6 +47,9 @@ operator fun <T : KotlinGradleFragment> KotlinGradleFragmentConfigurationDefinit
|
||||
operator fun <T : KotlinGradleFragment> KotlinGradleFragmentConfigurationDefinition<T>.plus(other: FragmentArtifacts<T>):
|
||||
KotlinGradleFragmentConfigurationDefinition<T> = copy(artifacts = artifacts + other)
|
||||
|
||||
operator fun <T : KotlinGradleFragment> KotlinGradleFragmentConfigurationDefinition<T>.plus(other: FragmentConfigurationRelation):
|
||||
KotlinGradleFragmentConfigurationDefinition<T> = copy(relations = relations + other)
|
||||
|
||||
@AdvancedExternalVariantApi
|
||||
operator fun <T : KotlinGradleFragment> KotlinGradleFragmentConfigurationDefinition<T>.plus(other: FragmentCapabilities<T>):
|
||||
KotlinGradleFragmentConfigurationDefinition<T> = copy(capabilities = capabilities + other)
|
||||
|
||||
+28
@@ -8,6 +8,7 @@
|
||||
package org.jetbrains.kotlin.gradle.plugin.mpp.pm20
|
||||
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.artifacts.ConfigurationPublications
|
||||
import org.jetbrains.kotlin.gradle.utils.addExtendsFromRelation
|
||||
|
||||
/* Internal abbreviation */
|
||||
@@ -21,6 +22,33 @@ interface KotlinGradleFragmentConfigurationRelation {
|
||||
}
|
||||
}
|
||||
|
||||
operator fun FragmentConfigurationRelation.plus(other: FragmentConfigurationRelation): FragmentConfigurationRelation {
|
||||
if (this === KotlinGradleFragmentConfigurationRelation.None) return other
|
||||
if (other === KotlinGradleFragmentConfigurationRelation.None) return this
|
||||
|
||||
if (this is CompositeFragmentConfigurationRelation && other is CompositeFragmentConfigurationRelation) {
|
||||
return CompositeFragmentConfigurationRelation(this.children + other.children)
|
||||
}
|
||||
|
||||
if (this is CompositeFragmentConfigurationRelation) {
|
||||
return CompositeFragmentConfigurationRelation(this.children + other)
|
||||
}
|
||||
|
||||
if (other is CompositeFragmentConfigurationRelation) {
|
||||
return CompositeFragmentConfigurationRelation(listOf(this) + other.children)
|
||||
}
|
||||
|
||||
return CompositeFragmentConfigurationRelation(listOf(this, other))
|
||||
}
|
||||
|
||||
internal class CompositeFragmentConfigurationRelation(val children: List<FragmentConfigurationRelation>) :
|
||||
FragmentConfigurationRelation {
|
||||
|
||||
override fun setExtendsFrom(configuration: Configuration, context: KotlinGradleFragmentConfigurationContext) {
|
||||
children.forEach { child -> child.setExtendsFrom(configuration, context) }
|
||||
}
|
||||
}
|
||||
|
||||
class KotlinGradleFragmentConfigurationRelationContext internal constructor(
|
||||
val configuration: Configuration,
|
||||
context: KotlinGradleFragmentConfigurationContext
|
||||
|
||||
+3
-1
@@ -26,7 +26,9 @@ data class KotlinNativeVariantConfig<T : KotlinNativeVariantInternal>(
|
||||
DefaultKotlinCompileDependenciesDefinition + KotlinFragmentKonanTargetAttribute,
|
||||
|
||||
val apiElements: ConfigurationDefinition<T> =
|
||||
DefaultKotlinApiElementsDefinition + KotlinFragmentKonanTargetAttribute,
|
||||
DefaultKotlinApiElementsDefinition
|
||||
+ KotlinFragmentKonanTargetAttribute
|
||||
+ FragmentConfigurationRelation { extendsFrom(dependencies.transitiveImplementationConfiguration) },
|
||||
|
||||
val hostSpecificMetadataElements: ConfigurationDefinition<T> =
|
||||
DefaultKotlinHostSpecificMetadataElementsDefinition,
|
||||
|
||||
Reference in New Issue
Block a user