[Gradle, MPP] Publish sources as gradle variants

Now when MPP library is published it will contain "sourcesElements"
variant for each target and one for common code.

Sources variants are published under gradle attributes that were
borrowed from Java Gradle Plugin for consistency reasons.
This makes it compatible with JVM tooling that rely on these attributes.

^KT-36943 Verification Pending
This commit is contained in:
Anton Lakotka
2022-11-29 14:55:14 +01:00
committed by teamcity
parent fd7ceabab6
commit 3fa85bf7fd
11 changed files with 204 additions and 96 deletions
@@ -34,6 +34,7 @@ interface KotlinTarget : Named, HasAttributes {
val defaultConfigurationName: String
val apiElementsConfigurationName: String
val runtimeElementsConfigurationName: String
val sourcesElementsConfigurationName: String
val publishable: Boolean
@@ -13,5 +13,11 @@ interface KotlinTargetComponent : SoftwareComponent {
val publishable: Boolean
val publishableOnCurrentHost: Boolean
val defaultArtifactId: String
@Deprecated(
message = "Sources artifacts are now published as separate variant " +
"use target.sourcesElementsConfigurationName to obtain necessary information",
replaceWith = ReplaceWith("target.sourcesElementsConfigurationName")
)
val sourcesArtifacts: Set<PublishArtifact>
}