paparazzi icon indicating copy to clipboard operation
paparazzi copied to clipboard

Make AGP and KGP deps compileOnly

Open ZacSweers opened this issue 2 years ago • 3 comments

Dependencies on other gradle plugins should be compileOnly dependencies, as it can accidentally impose the version paparazzi depends on rather than just use the one that the consuming project uses. For example – in our project, this transitive dep prevents us from testing newer AGP versions due to multiple versions appearing on the buildscript classpath.

image

ZacSweers avatar Sep 22 '23 19:09 ZacSweers

Dependencies on other gradle plugins should be compileOnly dependencies, as it can accidentally impose the version paparazzi depends on rather than just use the one that the consuming project uses. For example – in our project, this transitive dep prevents us from testing newer AGP versions due to multiple versions appearing on the buildscript classpath.

Is the newer plugin version check a new thing? We've definitely been able to pull in a newer AGP version on CashApp, with the risk of binary incompatibilities resulting in Paparazzi crashes, but that's different from your error message.

Re: the premise of compileOnly, I've previously attempted such (even consulting @autonomousapps given his success in having a test matrix in dependency-analysis-gradle-plugin), but @JakeWharton and I were of the opinion that it probably wasn't worth the maintenance burden, given AGP's dev cycle. Not opposed to it, if successful though.

jrodbx avatar Sep 28 '23 18:09 jrodbx

accidentally hit "Close with comment", just meant to "Comment". My bad.

jrodbx avatar Sep 28 '23 18:09 jrodbx

Is the newer plugin version check a new thing?

It's not a check, it's just how gradle and classloading work. It's a first-one-wins policy in many cases due to the hierarchical nature of gradle and generally just good plugin hygiene to not impose other plugin versions transitively. Things get tricky when you start assuming things about versions when a dependency appears sooner in that hierarchy (i.e. such as settings.gradle classpath) and later projects assume their dependency will win or be resolved with others.

ZacSweers avatar Oct 10 '23 17:10 ZacSweers