[gazelle] Support lazy indexing in the java gazelle plugin#397
Conversation
3396316 to
1e13921
Compare
|
I took a look at this today and hit issues in our repository which uses https://github.com/bazel-contrib/bazel-gazelle/blob/master/cmd/gazelle/fix-update.go#L338 Am I understanding the logic correctly? Do you think there is a way to handle this in the extension or do we need to suggest a reorganization of the upstream logic? |
|
The disconnect appears to be coming from the https://github.com/shs96c/rules_jvm/blob/gazelle-lazy-index/java/gazelle/resolve.go#L61 If my understanding is right; I'm unsure how to proceed:
|
8feac36 to
5e7ec8c
Compare
When using `gazelle:java_module_granularity module` with lazy indexing, `Imports()` now correctly returns package information even when `GenerateRules()` hasn't been called. The implementation uses a two-phase approach: 1. Infer package from file path using configured search paths (fast) 2. Verify by quick-scanning the file for the actual package declaration This respects all configured source roots including custom ones like `src/integrationTest/java` and package prefixes from `java_search`. Fixes the issue reported by @jeffmace where lazy indexing failed for repositories using module granularity because `Resolver.Imports` was reading cached package info that hadn't been populated.
5e7ec8c to
8d0507b
Compare
No description provided.