I'm getting a deprecation in 2.2.0 on `publishAllL...
# gradle
e
I'm getting a deprecation in 2.2.0 on
publishAllLibraryVariants
with the deprecation message saying:
Publishing all Android Variants implicitly is not recommended
Calling
publishAllLibraryVariants
is not implicit, it is explicit, and I am explicitly saying I want all variants published. I don't want to have to specify each variant that I want published (especially when I have lots of flavors). Furthermore, the doc for
publishLibraryVariants
says:
If set to null, which can also be done with publishAllLibraryVariants, all library variants will be published, but not test or application variants.
t
From https://kotlinlang.org/docs/compatibility-guide-22.html#deprecate-publishalllibraryvariants-function
This approach is not recommended now, as it can cause problems with variant resolution, especially when multiple flavors and build types are used. Use the
publishLibraryVariants()
function, which specifies build variants, instead.
Generally users were using it blindly and it caused problems
Specifically the problem is with publishing both debug and release build variants for the same project
e
Maybe more guidance is needed there? I've been publishing debug and release variants for years and I've never had an issue. If there is an issue and I'm not aware of it, it's not clear to me what I should be publishing.
t
why are you publishing debug releases? cc @Anton Lakotka [JB]
1
e
I don't know, I never found guidance on what to do, saw
publishAllLibraryVariants()
, used that, and never looked at it again (until now)
a
The idea behind deprecation is that we want to migrate Kotlin Multiplatform Gradle Plugin away from managing Android publications. i.e. it should be on AGP to decide what to publish and how. with this particular deprecation, I belive it is reported false positively. I need some details, as I havent touched this code fornquitensome time. w.r.t. problems, there can be problems for Pure AGP consumers when KMP project is published with multiple Android variants. And this problem is unfixable in the current puication model. just for reference https://youtrack.jetbrains.com/issue/KT-71552/KMP-AndroidTarget-doesnt-respect-Publishable-Components-configured-in-the-Android-Gradle-Plugin from there you can find more details and issues around it.
1
e
Interesting, I just checked my convention plugin, and it looks like I also configure publishing through AGP
Copy code
publishing {
          multipleVariants {
            allVariants()
            withJavadocJar()
            withSourcesJar()
          }
        }