Allow a target to have multiple publications, restructure the code
Instead of exposing a single `component` in a target, allow it to have a set of `components`, then create a Maven publication for each of the components. Move `createUsageContexts` to private API since a target that has multiple publications may need to create the usage contexts for those publications differently. Move some of the components technical stuff to interfaces `DelegatedToPublication` and `ComponentWithCoordinatesDelegatedToPublication` in order to reuse it later for Android's components.
This commit is contained in:
+2
-4
@@ -13,7 +13,6 @@ import org.gradle.api.Project
|
||||
import org.gradle.api.attributes.AttributeContainer
|
||||
import org.gradle.api.attributes.HasAttributes
|
||||
import org.gradle.api.component.SoftwareComponent
|
||||
import org.gradle.api.internal.component.UsageContext
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.util.ConfigureUtil
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions
|
||||
@@ -21,6 +20,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions
|
||||
interface KotlinTargetComponent : SoftwareComponent {
|
||||
val target: KotlinTarget
|
||||
val publishable: Boolean
|
||||
val defaultArtifactId: String
|
||||
}
|
||||
|
||||
interface KotlinTarget : Named, HasAttributes {
|
||||
@@ -41,9 +41,7 @@ interface KotlinTarget : Named, HasAttributes {
|
||||
|
||||
val publishable: Boolean
|
||||
|
||||
val component: KotlinTargetComponent
|
||||
|
||||
fun createUsageContexts(): Set<UsageContext>
|
||||
val components: Set<KotlinTargetComponent>
|
||||
|
||||
fun mavenPublication(action: Closure<Unit>)
|
||||
fun mavenPublication(action: Action<MavenPublication>)
|
||||
|
||||
Reference in New Issue
Block a user