feat(extensions): Custom Rule Source Provider#8141
feat(extensions): Custom Rule Source Provider#8141JamyDev wants to merge 3 commits intobazelbuild:ijwbfrom
Conversation
Summary of ChangesHello @JamyDev, 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 significantly enhances the Bazel plugin's ability to integrate with custom Bazel rules by providing a flexible mechanism for defining and collecting non-standard source attributes. By introducing a new extension point and updating the aspect generation logic, the IDE can now better understand and provide language support for projects utilizing custom rule types, improving the overall development experience and reducing manual configuration needs for specialized build setups. Highlights
Changelog
Activity
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 introduces a new extension point CustomRuleSourceConfig to allow plugins to specify source attributes for custom Bazel rules. This is a great feature for improving IDE support. The implementation looks mostly good, with new extension points in Java, updates to aspect template writers in Kotlin, and new documentation.
However, I've found a couple of critical issues in the Starlark aspect implementation (intellij_info_impl.bzl). The logic for collecting sources from custom attributes doesn't handle single-item attributes, and more importantly, the ide_info data structures created for custom rules are inconsistent with the existing ones, which will likely break parsing on the IDE side. I've provided suggestions to fix these issues.
The
CustomRuleSourceConfigextension point allows plugins to specify which attributes contain sources for custom rule types. This is useful when you have custom Bazel rules that have custom source attributes beyond the standardsrcs(as per #8140Checklist
Discussion thread for this change
Issue number: #8140
Description of this change
CUSTOM_RULE_SOURCEStocode_generator_info.bzlgetSourceAttributesvalue.aspect/intellij_info_impl.bzlto provide the updated sources, then passes that to the relevant ide_info struct.