Conversation
With the cc rules removed from Bazel, the `copts` attribute is no longer a part of the build language proto
Summary of ChangesHello @hvadehra, 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 compatibility issue arising from recent changes in Bazel, specifically the removal of 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.
Code Review
This pull request correctly fixes the type for default_copts since the copts attribute has been removed from the build language proto. Your change prevents a potential issue where the type would resolve to an incorrect zero value.
I've added a specific suggestion to apply this same pattern to other default attributes within the changed hunk to improve robustness. Additionally, you might want to consider applying a similar change for extra_srcs (line 80) and pytype_deps (line 81) which follow the same pattern of referencing another attribute's type and are outside the current diff.
| types["default_visibility"] = types["visibility"] | ||
| types["default_copts"] = types["copts"] | ||
| types["default_copts"] = buildpb.Attribute_STRING_LIST | ||
| types["default_deprecation"] = types["deprecation"] | ||
| types["default_testonly"] = types["testonly"] |
There was a problem hiding this comment.
While fixing default_copts is correct, several other default attributes here are defined by referencing other attributes (e.g., default_visibility references visibility). This creates a dependency on the referenced attributes existing in the proto, which as you've seen with copts, can be brittle. To make the code more robust against future changes, it's better to use the explicit types for all these default attributes.
| types["default_visibility"] = types["visibility"] | |
| types["default_copts"] = types["copts"] | |
| types["default_copts"] = buildpb.Attribute_STRING_LIST | |
| types["default_deprecation"] = types["deprecation"] | |
| types["default_testonly"] = types["testonly"] | |
| types["default_visibility"] = buildpb.Attribute_STRING_LIST | |
| types["default_copts"] = buildpb.Attribute_STRING_LIST | |
| types["default_deprecation"] = buildpb.Attribute_STRING | |
| types["default_testonly"] = buildpb.Attribute_BOOLEAN |
With the cc rules removed from Bazel, the
coptsattribute is no longer a part of the build language proto