Skip to content

Commit

Permalink
Fix partial execution with mapped kinds (#1680)
Browse files Browse the repository at this point in the history
Previously, if mapped kinds were in use (i.e. `go_library` -> `go_custom_library`),
and `gazelle update` was being run on just one directory, Gazelle's
indexing system would fail to correctly index build rules of the mapped-to
kind in directories that were not being re-built.

This is because the logic to handle mapped kinds was triggered only when
Generate() was run, not for Imports().

This PR solves the issue with the smallest fix. The whole kind-mapping
system is honestly kinda messy, and I didn't want to propose a major
refactor.

Co-authored-by: Eric Miller <[email protected]>
  • Loading branch information
HALtheWise and eric-skydio authored Dec 19, 2023
1 parent 0737e71 commit d63d86b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/gazelle/fix-update.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ func runFixUpdate(wd string, cmd command, args []string) (err error) {
// directory, just index the build file and move on.
if !update {
if c.IndexLibraries && f != nil {
for _, repl := range c.KindMap {
mrslv.MappedKind(rel, repl)
}
for _, r := range f.Rules {
ruleIndex.AddRule(c, r, f)
}
Expand Down

0 comments on commit d63d86b

Please sign in to comment.