Fix Stardoc in repos which use rules_go with Bazel 8+#4446
Fix Stardoc in repos which use rules_go with Bazel 8+#4446fmeum merged 4 commits intobazel-contrib:masterfrom
Conversation
Fixes bazel-contrib#4394 Requires bumping rules_cc dep (and making it a dep for legacy WORKSPACE users).
There was a problem hiding this comment.
Summary of Changes
Hello @tetromino, 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 addresses a critical compatibility issue where Stardoc failed to generate API documentation for rules_go projects when using Bazel 8+. The fix involves updating the rules_cc dependency and ensuring its proper declaration across both MODULE.bazel and WORKSPACE environments, thereby providing the necessary build toolchain information for Stardoc to function correctly.
Highlights
- Stardoc Compatibility Fix: Resolves an issue preventing Stardoc API documentation generation in repositories that use rules_go with Bazel 8+.
- Dependency Update: The rules_cc dependency has been updated to version 0.2.5 to ensure compatibility and provide necessary toolchain information.
- Legacy WORKSPACE Support: Explicitly adds rules_cc as a dependency for projects still using the legacy WORKSPACE file, ensuring consistent behavior across Bazel versions.
- Build Rule Dependencies: A direct dependency on @rules_cc//cc:find_cc_toolchain_bzl was added to go/private/BUILD.bazel to resolve transitive dependency issues related to toolchain discovery.
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 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
-
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. ↩
There was a problem hiding this comment.
Code Review
This pull request correctly addresses the Stardoc generation issue with Bazel 8+ by explicitly adding rules_cc as a dependency. The changes are consistently applied for both bzlmod and legacy WORKSPACE users. My feedback focuses on improving maintainability by adding comments to explain the new dependencies.
Avoids the rules_cc compatibility_proxy_repo mess (which makes WORKSPACE use difficult - will solve it when we need it) but is sufficiently new for Stardoc to still work.
Fixes #4394
Requires bumping rules_cc dep (and making it a dep for legacy WORKSPACE users).
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
Fixes Stardoc API doc generation when using Bazel 8 for .bzl files in repos which transitively depend upon rules_go
Which issues(s) does this PR fix?
Fixes #4394 and bazelbuild/stardoc#300
Other notes for review
You can test the code via
Do you want an integration test in rules_go which does this? I didn't add one because I didn't want to introduce a new dependency on Stardoc or mess with existing .bazelversion files.