@@ -41,7 +41,10 @@ import org.gradle.api.internal.component.SoftwareComponentInternal
4141import org.gradle.api.internal.component.UsageContext
4242import org.gradle.api.publish.maven.MavenPublication
4343import org.gradle.api.publish.maven.tasks.AbstractPublishToMaven
44+ import org.jetbrains.kotlin.gradle.ExternalKotlinTargetApi
4445import org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi
46+ import org.jetbrains.kotlin.gradle.plugin.KotlinTargetComponent
47+ import org.jetbrains.kotlin.gradle.plugin.mpp.external.DecoratedExternalKotlinTarget
4548
4649/* *
4750 * Usage that should be added to rootSoftwareComponent to represent target-specific variants
@@ -61,8 +64,17 @@ internal class CustomUsage(
6164 override fun getGlobalExcludes (): Set <ExcludeRule > = emptySet()
6265}
6366
67+ @OptIn(InternalKotlinGradlePluginApi ::class , ExternalKotlinTargetApi ::class )
68+ internal fun Project.setupRedirection (target : DecoratedExternalKotlinTarget , newRootComponent : CustomRootComponent ) {
69+ setupRedirection(target.kotlinComponents, newRootComponent)
70+ }
71+ @OptIn(InternalKotlinGradlePluginApi ::class )
72+ internal fun Project.setupRedirection (target : AbstractKotlinTarget , newRootComponent : CustomRootComponent ) {
73+ setupRedirection(target.kotlinComponents, newRootComponent)
74+ }
75+
6476@OptIn(InternalKotlinGradlePluginApi ::class )
65- internal fun Project.publishAndroidxReference ( target : AbstractKotlinTarget , newRootComponent : CustomRootComponent ) {
77+ internal fun Project.setupRedirection ( kotlinComponents : Set < KotlinTargetComponent > , newRootComponent : CustomRootComponent ) {
6678 afterEvaluate {
6779 extensions.getByType(PublishingExtension ::class .java).apply {
6880 val kotlinMultiplatform = publications
@@ -83,7 +95,7 @@ internal fun Project.publishAndroidxReference(target: AbstractKotlinTarget, newR
8395 if (it.publication.name == " kotlinMultiplatform" ) it.enabled = false
8496 }
8597
86- target. kotlinComponents.forEach { component ->
98+ kotlinComponents.forEach { component ->
8799 val componentName = component.name
88100
89101 if (component is KotlinVariant )
0 commit comments