From d63d86bec3468894b9e63599b0bb4bb28b058977 Mon Sep 17 00:00:00 2001 From: Eric Miller Date: Tue, 19 Dec 2023 02:17:28 -0800 Subject: [PATCH] Fix partial execution with mapped kinds (#1680) 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 --- cmd/gazelle/fix-update.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/gazelle/fix-update.go b/cmd/gazelle/fix-update.go index 4c6222698..67c1090b2 100644 --- a/cmd/gazelle/fix-update.go +++ b/cmd/gazelle/fix-update.go @@ -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) }