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

The big refactor — step 1: prep work #192

Merged
merged 8 commits into from Oct 20, 2023
Merged

The big refactor — step 1: prep work #192

merged 8 commits into from Oct 20, 2023

Conversation

rock3r
Copy link
Collaborator

@rock3r rock3r commented Oct 19, 2023

This is the first step of "the big refactor".

In this step:

  • We replace data classes in public APIs with Poko — a compiler plugin that generates equals/hashcode/toString but not methods like copy and componentN which easily break binary compatibility. This fixes Remove usage of data classes #83 (see issue for more details)
  • We add the kotlinx binary-compatibility-validator plugin, that generates a list of all public APIs exposed by the published modules — the bulk of the changes in this PR are the new .api files, that track the current state of the public API (they can be skipped when reviewing). A new apiCheck is added to the check task that ensures no changes break binary compatibility by mistake.
  • We add a new validatePublicApi task to published modules that breaks the check task whenever a data class is detected in the public API

Important

After this PR is merged, whenever adding new APIs, you need to run the apiDump method to update the .api files. If API changes are detected that are not in the .api files, the CI will fail.

@rock3r rock3r added the feature New feature or request label Oct 19, 2023
@rock3r rock3r added this to the Milestone 8 — v0.8.0 milestone Oct 19, 2023
@rock3r rock3r self-assigned this Oct 19, 2023
@rock3r rock3r enabled auto-merge (squash) October 19, 2023 18:10
1. Running binary-compatibility-validator on code
2. Flagging public data classes and failing build
3. Running Poko to autogen equals/hashcode/toString
@devkanro
Copy link
Collaborator

devkanro commented Oct 20, 2023

After this PR is merged, whenever adding new APIs, you need to run the apiDump method to update the .api files

And how about add a CI pipeline to make sure contributors updated the api files?

@rock3r
Copy link
Collaborator Author

rock3r commented Oct 20, 2023

@devkanro if you forget to update the API signatures, the ci will fail

Copy link
Collaborator

@devkanro devkanro left a comment

Choose a reason for hiding this comment

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

LGTM

@rock3r rock3r merged commit 0101ed3 into main Oct 20, 2023
12 checks passed
@rock3r rock3r deleted the the-big-refactor-prep branch October 20, 2023 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove usage of data classes
2 participants