binary-compatibility-validator icon indicating copy to clipboard operation
binary-compatibility-validator copied to clipboard

Incremental validation

Open diareuse opened this issue 1 year ago • 2 comments

The Problem

Most of the time the developer wants to know whether the changes done to the project are compatible with the previous version. This is not currently possible due to the hard fail during the apiCheck (check) phase. It verifies that the API has not changed at all, which loads the developer with more chores and responsibilities, that could be inherently automated.

Suggested solution

Introduce a mode in which compatibility validator actually only validates the binary compatibility (not identity) to the previous version. These changes almost exclusively include additions - new methods, new fields, new classes.

Since the compatibility validator already conveniently provides a diff of lines changed, new mode can be introduced to allow searching for removals and in only that case, hard fail the task.


It naturally allows for a workflow which could be similar to following:

  • Make changes
  • Test them, Verify compatibility (aka check)
  • Commit
  • Merge
  • Use CI to commit updated .api file

Therefore it poses a slight deviation from "Regular Workflow", but for a good reason. If the developer works on a gargantuan project, they should not be asked to study the project configuration as they are only responsible for making changes and not breaking compatibility. This is in turn a responsibility of the plugin to verify. In other words their time is better spent studying the current domain, instead of the project build harness.

Regular Workflow therefore (speculation) proposes isolated instances of different kinds of build/verification instrumentation for each team or module, as the team would have to know instrumentation tasks to essentially not break compatibility if not done automatically. This is what I'd love to avoid.


I submitted a PR #186 which resolves this problem and allows for incrementally compatible checks only.

Reviewers are welcome to submit notes, questions or improvements for the given PR.

Obviously there's a plethora of options that could be introduced to the gradle extension to expand this feature to the moon. However to keep the scope for this new feature small, I opted for a simple flag which swaps the internal implementation of the apiCheck task.

diareuse avatar Feb 05 '24 13:02 diareuse