Skip to content

feat(extensions): ArtifactLocationTransformer#8142

Open
JamyDev wants to merge 3 commits intobazelbuild:ijwbfrom
JamyDev:feat/artifact-location-transformer
Open

feat(extensions): ArtifactLocationTransformer#8142
JamyDev wants to merge 3 commits intobazelbuild:ijwbfrom
JamyDev:feat/artifact-location-transformer

Conversation

@JamyDev
Copy link
Contributor

@JamyDev JamyDev commented Feb 5, 2026

Checklist

  • I have filed an issue about this change and discussed potential changes with the maintainers.
  • I have received the approval from the maintainers to make this change.
  • This is not a stylistic, refactoring, or cleanup change.

Discussion thread for this change

Issue number: #8140

Description of this change

Adds the ArtifactLocationTransformer extension point that lets an external plugin transform the ArtifactLocation for a specific file. In our above mentioned case, converts a <src>_cffgen.go back into <scr>.go so the IDE can resolve the package correctly to the source paths.

The transformer gets called in base/src/com/google/idea/blaze/base/ideinfo/ArtifactLocation.java when available.

@github-actions github-actions bot added product: CLion CLion plugin product: IntelliJ IntelliJ plugin product: GoLand GoLand plugin awaiting-review Awaiting review from Bazel team on PRs labels Feb 5, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @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 enhances the Bazel plugin for IntelliJ by introducing a new extension point, ArtifactLocationTransformer. This allows external plugins to intercept and modify ArtifactLocation objects as they are converted from Bazel's proto format into the IDE's model. The primary benefit is to enable correct resolution of generated source files (e.g., converting _cffgen.go to .go), thereby improving IDE functionality and user experience for projects with complex build outputs.

Highlights

  • New Extension Point: Introduced the ArtifactLocationTransformer extension point, allowing external plugins to modify ArtifactLocation objects during the synchronization process.
  • Dynamic Path Transformation: This extension enables customization of artifact paths, which is particularly useful for mapping generated files (e.g., _cffgen.go) back to their original source equivalents (.go) for correct IDE resolution.
  • Integration into Artifact Creation: The transformation logic is applied directly within the ArtifactLocation.fromProto() method, ensuring that all subsequent code interacts with the transformed artifact paths.
  • Comprehensive Documentation: A new markdown document (artifact_location_transformer.md) has been added, providing detailed instructions, implementation examples, and usage notes for the new extension point.
Changelog
  • base/src/META-INF/blaze-base.xml
    • Added the declaration for the new ArtifactLocationTransformer extension point.
  • base/src/com/google/idea/blaze/base/ideinfo/ArtifactLocation.java
    • Modified the fromProto static method to iterate through and apply all registered ArtifactLocationTransformer extensions to the ArtifactLocation object before returning it.
  • base/src/com/google/idea/blaze/base/ideinfo/ArtifactLocationTransformer.java
    • Created a new Java interface ArtifactLocationTransformer with a single transform method and an ExtensionPointName constant for registration.
  • docs/extension_points/artifact_location_transformer.md
    • Added a new markdown document detailing the purpose, implementation steps, registration process, and important notes for using the ArtifactLocationTransformer extension point.
Activity
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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

  1. 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.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 a new extension point, ArtifactLocationTransformer, which allows plugins to modify ArtifactLocation objects during synchronization. This is a valuable feature for mapping generated files to their sources. The implementation is straightforward, and I appreciate the inclusion of documentation. My review focuses on ensuring the correctness of object interning to maintain memory efficiency, improving code cleanliness by removing an unused import, and correcting the example in the new documentation to be both valid and functionally correct. All original comments are retained as they do not contradict any provided rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review Awaiting review from Bazel team on PRs product: CLion CLion plugin product: GoLand GoLand plugin product: IntelliJ IntelliJ plugin

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

4 participants