Kotlin / binary-compatibility-validator

Public API management tool
Apache License 2.0
761 stars 55 forks source link

Add a config for apiCheck only failing on deletions and changes, and ignoring additions #150

Closed mmollaverdi closed 10 months ago

mmollaverdi commented 10 months ago

In places where we're using this plug-in, we've ended up ignoring the apiCheck failures at times, due to many failures being due to new APIs being added, which are not breaking changes. This new configuration makes it so that apiCheck only fails if the existing API lines have been changed or deleted, indicating either new arguments being added to an exisitng function/method or an existing function/method being deleted. Both of these situations are potential breaking changes and what we want to fail the bulid for.

mmollaverdi commented 10 months ago

@qwwdfsad can I please clarify a few things

Not every removal or change is incompatible, and we would like to avoid semi-robust or obviously imprecise tools

I deliberately avoided calling the new option onlyFailOnIncompatibleChanges or similar for this reason (it's called ignoreAdditions). The intention is to increase the signal-to-noise ratio, so that API check doesn't fail for additions which to my understanding are always compatible? Also note that this option is defaulted to false.

Additions might be binary compatible, but after they are released, their ignored absence is not ...

There might be a misunderstanding here. The new ignoreAddition option, when enabled, only changes the behaviour of apiCheck so that it fails on delations and changes. It doesn't impact what apiDump does (perhaps the option name needs to be explicit about being applicable only to apiCheck?) Does that address your concerns?

My plan for using this new option is to have apiDump run as part of the build AFTER apiCheck. That'd mean