-
Notifications
You must be signed in to change notification settings - Fork 237
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
Fix issue where a jetified maven artifact did not also jetify the deps #386
Conversation
This PR still needs some work because maven_install.json itself should be changed to provide the jetified deps because we need coursier to figure out the dep graph of the jetified dependencies. The approach here of just changing in ingestion of maven_install.json isn't sufficient since it requires that you either explicitly add the jetified artifacts into your list of maven artifacts to install or that someone else explicitly depend on it in POM which is unreliable. |
Thanks. I've been wanting to generate the BUILD file using directDependencies instead of dependencies, ever since Coursier added it. We don't need Coursier to figure out the dep graph of the dependencies. Since we now have the map of coordinate transformations, we can modify this code path ( rules_jvm_external/coursier.bzl Lines 564 to 628 in 2a2c079
|
I'm not too sure this works because we'd also need to add in the entries for androidx deps and transitive deps and version conflict resolution. |
@jin Would you be OK with a 2-pass coursier fetch where we add an extra fetch to grab the added androidx dependencies and then use this second fetch as the basis for the pinned json? |
@jin I think this is ready for review now. Take a look when you can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this.
This took a while to review because of the large refactoring delta, and the code diverged away from a linear-ish read into functions, which I don't personally prefer. It'd be great it if the diff was smaller without the unrelated changes.
Do you think you can submit this change with a smaller delta for the jetifier specific work instead?
I wanted to avoid copy-pasting the big chunk of code to fetch using coursier twice so I was hoping to keep that one function ( I can certainly inline the other functions I used. |
Sounds good. A 2-pass fetch seems fine to me, as long as it's clear to end users that there's a cost to this. Perhaps note it in the documentation or surface in the |
@jin I think I've addressed your comments and you can take another look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This is much easier to review.
There are two main changes in this PR:
This fixes an issue where a jetified maven artifact would still depend on un-jetified maven artifacts which led to a lot of problems with duplicate classes and resources since having both a jetfied and un-jetified android support library in your classpath is a very bad idea.