Skip to content

Conversation

@shs96c
Copy link
Collaborator

@shs96c shs96c commented Dec 5, 2025

No description provided.

@shs96c shs96c force-pushed the gazelle-lazy-index branch from 3396316 to 1e13921 Compare December 11, 2025 18:13
@jeffmace
Copy link
Contributor

I took a look at this today and hit issues in our repository which uses gazelle:java_module_granularity module. The current lazy-indexing logic will only index directories that include BUILD.bazel files. This condition fails in our repository so the additional paths are not indexed.

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?

@jeffmace
Copy link
Contributor

The disconnect appears to be coming from the Resolver.Imports function. It is reading the cached package information from the rule. But that package information is populated by GenerateRules which hasn't been called.

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:

  • Update Imports to return a set of ImportSpec based on the pathnames for the files in the Rule if it matches the Maven layout
  • Breakout the java parsing logic from GenerateRules so it can be called from Imports if the package data isn't available
  • Work with the Gazelle maintainers to reorder the logic so GenerateRules is called before Imports

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants