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

Declare byte-buddy as 'implementation' dependency instead of shading. #4266

Merged
merged 9 commits into from
Nov 18, 2024

Conversation

sellmair
Copy link
Member

@sellmair sellmair commented Nov 4, 2024

Shading byte buddy might have negative effects:

  • It increases binary size by ~3MB w/o an easy option to opt-out
  • It causes JPMS issues (because of the re-location itself)

The used APIs from the dependency can be considered stable.

Copy link
Collaborator

@dkhalanskyjb dkhalanskyjb left a comment

Choose a reason for hiding this comment

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

I don't have comments to the overall idea of not using shading, but then, https://github.com/Kotlin/kotlinx.coroutines/tree/master/kotlinx-coroutines-debug#build-failures-due-to-duplicate-resource-files needs to be updated so that it no longer mentions the issues related to shading.

@sellmair sellmair requested a review from dkhalanskyjb November 7, 2024 16:04
@sellmair
Copy link
Member Author

sellmair commented Nov 7, 2024

Updated the readme ✅

Copy link
Collaborator

@qwwdfsad qwwdfsad left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of it!

Repackaging was instead an overcautious decision because byte-buddy was used everywhere, and it was totally unclear if they have a proper compatibility policy (they do!), and back then JPMS wasn't big of an issue.

@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Nov 11, 2024

@dkhalanskyjb waiting for your review as well here, as you already started viewing the mechanical aspect of the change

Copy link
Collaborator

@dkhalanskyjb dkhalanskyjb left a comment

Choose a reason for hiding this comment

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

With this change, we are no longer shading anything, so could you please also remove all mentions of the shadow plugin from our library?

@@ -170,9 +170,6 @@ conflicts, but:
* `kotlinx-coroutines-debug` transitively depends on JNA and JNA-platform, both of which include license files in their
META-INF directories. Trying to merge these files leads to conflicts, which means that any Android project that
depends on JNA and JNA-platform will experience build failures.
* Additionally, `kotlinx-coroutines-debug` embeds `byte-buddy-agent` and `byte-buddy`, along with their resource files.
Then, if the project separately depends on `byte-buddy`, merging the resources of `kotlinx-coroutines-debug` with ones
from `byte-buddy` and `byte-buddy-agent` will lead to conflicts as the resource files are duplicated.
Copy link
Collaborator

Choose a reason for hiding this comment

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

With this change, the list above only has a single bullet point (so it's strange that it's still a list), and also, in addition to JNA and JNA-platform mentioned above, kotlinx-coroutines-debug now depends on byte-buddy and byte-buddy-agent.

Copy link
Member Author

Choose a reason for hiding this comment

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

At this point, I think one of two ways is more efficient than ping-ponging in this review.
Either we merge the contribution as is and you can quickly edit the readme to your liking in a new commit, or you might just want to edit the commit directly pre merge.

WDYT?

Copy link
Collaborator

@dkhalanskyjb dkhalanskyjb Nov 13, 2024

Choose a reason for hiding this comment

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

There's also a third way, the one we usually take in this library: the contributor carefully looks at the places affected by the proposed change, considers the consequences, and then introduces sweeping, coordinated edits. In other words, instead of making a small isolated change, they consider the bigger picture. A reviewer's job then boils down to highlighting the affected areas the contributor hasn't thought of / didn't know about (without enumerating every specific line of code to change), after which the contributor goes back to researching what the proposed change entails and introduces further sweeping edits. No ping-ponging results, as the list of such areas to consider is typically limited.

Although the third way is preferred, both of the options you've proposed are okay: we're also glad and thankful to accept incomplete contributions if the contributor says: "I'm no longer interested in working on this, you do it." In this scenario, the credit still goes to the contributor.

Copy link
Member Author

Choose a reason for hiding this comment

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

I pushed an update, please provide feedback

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice, thanks! I've also left a comment with my review, it's possible that you've missed it:

With this change, we are no longer shading anything, so could you please also remove all mentions of the shadow plugin from our library?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done ✅

@sellmair sellmair force-pushed the sellmair/byte-buddy branch from ee48309 to c10a35d Compare November 18, 2024 06:21
Copy link
Collaborator

@dkhalanskyjb dkhalanskyjb left a comment

Choose a reason for hiding this comment

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

Great job, thank you!

@dkhalanskyjb dkhalanskyjb merged commit ddd869e into develop Nov 18, 2024
1 check was pending
@dkhalanskyjb dkhalanskyjb deleted the sellmair/byte-buddy branch November 18, 2024 11:47
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.

3 participants