-
Notifications
You must be signed in to change notification settings - Fork 2
fix: use jdk11 as the default_java_toolchain #77
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
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThe changes introduce a new Java toolchain configuration targeting JDK 11 in the Bazel build system. The BUILD.bazel file defines and registers this toolchain, while the WORKSPACE.bazel file registers it for use. The Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Bazel
participant Toolchain
participant JDK_11_Runtime
User->>Bazel: Build Java target
Bazel->>Toolchain: Select toolchain (default_remotejdk_11_toolchain)
Toolchain->>JDK_11_Runtime: Use remote JDK 11 (source/target 11)
Bazel->>User: Build completes using JDK 11 toolchain
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
PR Summary
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here: https://app.greptile.com/review/github.
2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
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.
Hello @albertocavalcante, 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!
Summary of Changes
Hello team, Gemini here, providing a summary of this pull request. The primary goal of this PR, as indicated by the title and linked issues, is to update the default Java toolchain used by this project to JDK 11. This change aims to address specific issues related to Java toolchain resolution and default versions within the Bazel and rules_java ecosystem. The changes involve defining a new JDK 11 toolchain configuration and then registering it in the workspace so Bazel can automatically discover and use it as the default.
Highlights
- Default JDK Version: This pull request changes the default Java Development Kit (JDK) version used by the project's Bazel build to JDK 11.
- Toolchain Definition: A new
default_java_toolchainand correspondingtoolchainrule are defined inBUILD.bazelto configure the JDK 11 toolchain provided by@rules_java//toolchains:remote_jdk11. - Toolchain Registration: The newly defined JDK 11 toolchain is registered in the
WORKSPACE.bazelfile usingregister_toolchains, making it available for Bazel to select as the default.
Changelog
- BUILD.bazel
- Added a
loadstatement for thedefault_java_toolchainrule. - Defined a
default_java_toolchainrule (default_remotejdk_11_toolchain_impl) pointing to the remote JDK 11 runtime and setting source/target versions to 11. - Defined a
toolchainrule (default_remotejdk_11_toolchain) to register the implementation with the standard JDK toolchain type.
- Added a
- WORKSPACE.bazel
- Added comments referencing the GitHub issues this change addresses.
- Added a
register_toolchainscall to register the//:default_remotejdk_11_toolchaindefined inBUILD.bazel.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and 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 to provide feedback.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
521549a to
ffebf23
Compare
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 effectively addresses the need to default to JDK 11 by defining and registering a custom Java toolchain. The changes are clear, concise, and follow standard Bazel practices. This is a good fix for the issues linked in the PR description (bazelbuild/bazel#19934 and bazelbuild/rules_java#148).
I have one suggestion regarding a comment in the BUILD.bazel file for improved clarity and long-term maintainability. Overall, great work!
Summary of Findings
- Developer Note in BUILD file: A
bazel querycommand inBUILD.bazel(line 9) seems like a developer note. It's recommended to either remove it for conciseness or rephrase it as a more descriptive comment if it provides lasting value for maintenance. A review comment has been added for this. - Code Correctness and Approach: The method of defining a
default_java_toolchainusing@rules_java//toolchains:remote_jdk11and registering it viaregister_toolchainsis the correct and standard Bazel approach to enforce a specific JDK version. This effectively addresses the linked issues. - Toolchain Registration Order: Placing the
register_toolchains("//:default_remotejdk_11_toolchain")call beforerules_java_toolchains()inWORKSPACE.bazelis appropriate to ensure the custom toolchain is prioritized. - Contextual Comments in WORKSPACE.bazel (Low Severity - Not commented): The comments in
WORKSPACE.bazel(lines 17-18) linking to the relevant GitHub issues are very helpful for context. Their current placement is fine. This was considered a low-severity observation, and per review settings, a direct comment was not added.
Merge Readiness
The pull request is well-structured and correctly implements the default JDK 11 toolchain. Addressing the one medium-severity comment regarding the developer note in BUILD.bazel would further improve the clarity and maintainability of the codebase. Once that minor point is considered, the PR should be in excellent shape for merging. As a reviewer, I am not authorized to approve pull requests; please ensure further necessary reviews and approvals are obtained before merging.
BUILD.bazel
Outdated
| visibility = ["//visibility:public"], | ||
| ) | ||
|
|
||
| # bazel query 'filter(".*remote.*jdk.*", @rules_java//toolchains:all)' |
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.
This comment appears to be a raw bazel query command, likely used during development to find available JDK toolchains. While such notes can be useful, leaving raw commands without context in a BUILD file can reduce clarity and potentially become outdated.
Could we either:
- Remove this comment if it's not essential for understanding or maintaining this toolchain definition?
- Rephrase it to be more descriptive about its purpose if it's intended as guidance for future maintainers (as shown in the suggestion)?
This would help keep the BUILD.bazel file focused on definitions and improve its readability.
# To discover other available remote JDKs from @rules_java for future reference (e.g., for updates),
# you can use a query like: bazel query 'filter(".*remote.*jdk.*", @rules_java//toolchains:all)'
ffebf23 to
99d55e4
Compare
Summary by CodeRabbit