Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public API compatibility validator #217

Open
marandaneto opened this issue Jan 11, 2024 · 0 comments
Open

Public API compatibility validator #217

marandaneto opened this issue Jan 11, 2024 · 0 comments

Comments

@marandaneto
Copy link
Member

marandaneto commented Jan 11, 2024

As an SDK, we should avoid breaking changes, whenever possible obviously.

Sometimes we'd do them, but then we'd need to increase a minor or major version if following semver.

The goal of this issue is to keep track of the Public API.

To do that, we could use the binary-compatibility-validator plugin.

This plugin generates a file with all the public methods, and every time you either increase or decrease the public API, this file is gonna be changed and you could see the changes during the PR review, if it was an intentional change, all good, if it's by mistake, then you'd know before shipping the change, it's a preventive approach rather than reactive.

Example of the generated file.
Example of the setup.
Example generating the file.
When you run eg ./gradlew check but don't do ./gradlew apiDump before, the build is gonna fail if you increased/decreased the public API not intentionally.

Something to consider is also using the explicitApi Kotlin mode.

This will force you to set all the visibility modifiers in methods, properties, classes, etc, it could be a bit of boilerplate (eg setting all the classes to public - it is public by default already), but it is more explicit and is better for identifying breaking changes proactively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant