[gazelle] Handle proto libraries creating split packages#425
Open
shs96c wants to merge 2 commits into
Open
Conversation
Track same-package type references and defined classes (including inner classes) through the Java parser, protobuf interface, and Go-side consumption. This improves dependency resolution when Java packages are split across multiple Bazel packages. Key changes: - Java parser: track samePackageTypeReferences and definedClasses, handle class literals (Foo.class), static type imports, type parameters in scope, and private inner class filtering - Protobuf: add same_package_type_references and defined_classes fields - Go plumbing: map new proto fields, add DefinedClasses to Package, add BareInnermostClassName() for inner class resolution - Resolution: use DefinedClasses for exported class tracking, improve non-local import filtering for split packages, index by innermost class name, add dedup helpers
Parse .proto files from existing proto_library rules to extract java_package options and register proto-generated classes for resolution. This handles the case where proto_library rules create split packages with regular Java code — e.g., when a Java class imports types generated by a proto_library in a different Bazel package but the same Java package.
35c8200 to
839eb5b
Compare
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.
Builds on #424
Parse .proto files from existing
proto_libraryrules to extractjava_packageoptions and register proto-generated classes for resolution. This handles the case whereproto_libraryrules create split packages with regular Java code, such as when a Java class imports types generated by aproto_libraryin a different Bazel package but the same Java package.