KT-38954: Filter Android attributes during publishing

* Always filter out the variant name attribute: it is never requested
  by consumers, while its presence makes Gradle count it as an
  unmatched attribute, sometimes leading to ambiguity;

* Filter out the build type attribute: if all variants have the same
  build type, then remove the build type attribute from all variants;
  Otherwise, remove the build type attribute from the release variants
  in order to make them compatible with all other consumer's build 
  types.

  * Add an opt-out flat for always keeping the attribute:
    "kotlin.android.buildTypeAttribute.keep" Gradle property

Issue #KT-38954 Fixed
This commit is contained in:
Sergey Igushkin
2021-06-09 10:18:15 +00:00
committed by Space
parent de76aeb9d1
commit 14a7e90c69
11 changed files with 232 additions and 21 deletions
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions
interface KotlinTargetComponent : SoftwareComponent {
val target: KotlinTarget
val publishable: Boolean
val publishableOnCurrentHost: Boolean
val defaultArtifactId: String
val sourcesArtifacts: Set<PublishArtifact>
}