fix(gazelle): generate target names from proto file name, not directory#128
Open
electronjoe wants to merge 1 commit intobufbuild:mainfrom
Open
fix(gazelle): generate target names from proto file name, not directory#128electronjoe wants to merge 1 commit intobufbuild:mainfrom
electronjoe wants to merge 1 commit intobufbuild:mainfrom
Conversation
Fix target name generation in the buf gazelle plugin's `CrossResolve` function to use the proto file name instead of the directory name. This aligns with the official Bazel proto_library naming convention documented at: https://bazel.build/reference/be/protocol-buffer Per Bazel's convention: "A file named foo.proto will be in a rule named foo_proto, which is located in the same package." The original code used `proto.RuleName(path.Dir(importSpec.Imp))` which incorrectly derived target names from the directory path. Example import: `logical/interface.proto` Before (wrong): `@buf_deps//logical:logical_proto` (from directory) After (correct): `@buf_deps//logical:interface_proto` (from file) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1418570 to
bc32353
Compare
Contributor
Author
|
I have now rebased this MR to clean up the Pull Request (as it was stacked on !127 which just merged). Please take a look and let me know your thoughts! We appreciate your work on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR stacks on top of !127 but I've split them as the rationale is different / you might not agree with both (let me know!). The issue of this PR was uncovered in !127 fix of #117. This PR Plus !127 resolve at least the base case issues of #117.
Fix target name generation in the buf gazelle plugin's
CrossResolvefunction to use the proto file name instead of the directory name. This aligns with the official Bazel proto_library naming convention documented at: https://bazel.build/reference/be/protocol-bufferPer Bazel's convention: "A file named foo.proto will be in a rule named foo_proto, which is located in the same package."
The original code used
proto.RuleName(path.Dir(importSpec.Imp))which incorrectly derived target names from the directory path.Example import:
logical/interface.protoBefore (wrong):
@buf_deps//logical:logical_proto(from directory)After (correct):
@buf_deps//logical:interface_proto(from file)Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com