-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Allow module extension tags to be compared #27883
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
base: master
Are you sure you want to change the base?
Conversation
|
@bazel-io fork 9.0.0 |
Summary of ChangesHello @fmeum, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant enhancement to module extensions by enabling the comparison of tag objects. This functionality allows module extensions to programmatically understand the relative ordering of tags, which is crucial for implementing logic that depends on the sequence in which tags are defined. The change provides module extension authors with greater control and flexibility in how they process and interpret tag configurations. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces the ability to compare module extension tags, which is a great feature for determining precedence. The implementation is solid: TypeCheckedTag now implements Comparable, using a cleverly constructed compareKey from module and tag indices to ensure a correct and efficient sort order. The new tests are thorough, covering both unit-level comparisons and an end-to-end scenario with multiple modules and tag classes. The switch to LinkedHashMap for storing tags is also a nice touch for improving determinism.
I've found one area for improvement regarding the Comparable contract, which I've detailed in a specific comment.
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/TypeCheckedTag.java
Show resolved
Hide resolved
RELNOTES: By comparing tag objects, module extensions can check which one preceded the other within a module file and/or in BFS module order, even across tag classes. This allows them to determine precedence based on order when tags from different tag classes are specified.
|
@bazel-io fork 8.5.0 |
RELNOTES: By comparing tag objects, module extensions can check which one preceded the other within a module file and/or in BFS module order, even across tag classes. This allows them to determine precedence based on order when tags from multiple tag classes interact.
Context: https://github.com/bazel-contrib/rules_go/pull/4526/files#r2586719526