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

Adds the binary compatibility validator plugin #938

Merged
merged 4 commits into from
Oct 30, 2024

Conversation

Jolanrensen
Copy link
Collaborator

@Jolanrensen Jolanrensen commented Oct 29, 2024

Fixes #634 by adding https://github.com/Kotlin/binary-compatibility-validator

See the individual commits for all checks. I started by adding the .api files built using the 0.14.1 release branch, to see whether we already made changes to the API.

This correctly showed me:

The plugin automatically runs when check or build runs, so that's nice :) I added it only to the public modules, skipping the examples, plugins, etc.

When updating the public API we'll need to try to keep binary compatibility as best as possible, resorting to deprecating old functions instead of just removing/changing them. And if we introduce a breaking change, we'll need to inform the users in the release notes and run apiDump to overwrite the .api files.

A non-breaking change would be a + in the API check, this means we simply add another function or overload. A breaking change would be a -. Those will cause NoSuchMethodErrors when called from an older version:

image

For more information, check https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html

Hint: Sometimes DeprecationLevel.HIDDEN can help to remove a function from the API while keeping it in the bytecode. The Api checker plugin still shows it as a -, but it can still be called from a compiled library, avoiding a NoShuchMethodError.

@Jolanrensen Jolanrensen marked this pull request as ready for review October 29, 2024 14:55
@@ -5,6 +5,7 @@ plugins {
alias(kover)
alias(ktlint)
alias(jupyter.api)
alias(binary.compatibility.validator)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's disable for a while

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From other hand, it's just a check and could help to discover stuff, which should be documented!

Copy link
Collaborator Author

@Jolanrensen Jolanrensen Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't hurt to add it, right? It will just inform you when you make a binary breaking change, after which you can call apiDump, commit the result and the error goes away. But most importantly it makes you aware of the changes that we'll need to inform our users about for the next release.

@zaleslaw zaleslaw self-requested a review October 30, 2024 12:24
@Jolanrensen Jolanrensen merged commit a1294f1 into master Oct 30, 2024
8 of 12 checks passed
@Jolanrensen Jolanrensen deleted the binary-compatibility-generator branch October 30, 2024 12:50
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

Successfully merging this pull request may close these issues.

Add binary compatibility validator to dataframe-core
2 participants