Android Multi Variant Library
data class AndroidMultiVariantLibrary @JvmOverloads constructor(val sourcesJar: Boolean = true, val publishJavadocJar: Boolean = true, val includedBuildTypeValues: Set<String> = emptySet(), val includedFlavorDimensionsAndValues: Map<String, Set<String>> = emptyMap()) : Platform
To be used for com.android.library projects. Applying this creates a publication for the component of the given variants. Depending on the passed parameters for javadocJar and sourcesJar, -javadoc and -sources jars will be added to the publication.
If the includedBuildTypeValues and includedFlavorDimensionsAndValues parameters are not provided or empty all variants will be published. Otherwise, only variants matching those filters will be included.
Equivalent Gradle set up (AGP 7.1.1):
android {
publishing {
multipleVariants {
allVariants() // or calls to includeBuildTypeValues and includeFlavorDimensionAndValues
withSourcesJar()
withJavadocJar()
}
}
}
afterEvaluate {
publishing {
publications {
create<MavenPublication>("default") {
from(components["default"])
}
}
}
}Content copied to clipboard