Fix publishing with Gradle 5.3 (KT-30379)
In Gradle 5.3, there was a change to the internal logic of publishing `SoftwareComponent`s with the 'maven-publish' plugin, and, simultaneously, a new public API was introduced for user-defined software components, see https://github.com/gradle/gradle/pull/8399 Earlier, the 'maven-publish' plugin used the Gradle `Usage` attribute values to arrange the dependencies of a software component's `UsageContext`s into the Maven scopes. Now that mechanism doesn't work and a `SoftwareComponent` must provide an explicit mapping of the variants to POMs by using the `SoftwareComponentFactory.adhoc` API. However, the new API lacks some features we need to properly publish an MPP, such as adding a component to another one as a variant, so we still create old-style software components under the hood and then wrap them into the new API (and then wrap the adhoc components once again). We also continue to use the old-style components for Kotlin-specific logic like finding a target in another project that a dependency resolved to, as the components produced by the new API lack crucial information that is used in the logic, like references to `KotlinCompilation`s. Issue #KT-30379 Fixed
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@ interface KotlinTarget : Named, HasAttributes {
|
||||
|
||||
val publishable: Boolean
|
||||
|
||||
val components: Set<KotlinTargetComponent>
|
||||
val components: Set<SoftwareComponent>
|
||||
|
||||
fun mavenPublication(action: Closure<Unit>)
|
||||
fun mavenPublication(action: Action<MavenPublication>)
|
||||
|
||||
Reference in New Issue
Block a user