glob blame
A vote for this is a vote for transparency!
Bugs: me
Test: here's what it looks like:
```
:) m
...
First culprit glob: frameworks/native/libs/binder/**/*
Globs changed, rerunning soong...
```
Change-Id: I71a3b39f540e49dba875db4c3b523179fa0e77cc
diff --git a/ui/build/soong.go b/ui/build/soong.go
index 41425ac..f70d9b7 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -766,7 +766,11 @@
globsChan := make(chan pathtools.GlobResult)
errorsChan := make(chan error)
wg := sync.WaitGroup{}
+
hasChangedGlobs := false
+ var changedGlobNameMutex sync.Mutex
+ var changedGlobName string
+
for i := 0; i < runtime.NumCPU()*2; i++ {
wg.Add(1)
go func() {
@@ -804,6 +808,13 @@
} else {
if !slices.Equal(result.Matches, cachedGlob.Matches) {
hasChangedGlobs = true
+
+ changedGlobNameMutex.Lock()
+ defer changedGlobNameMutex.Unlock()
+ changedGlobName = result.Pattern
+ if len(result.Excludes) > 0 {
+ changedGlobName += " (excluding " + strings.Join(result.Excludes, ", ") + ")"
+ }
}
}
}
@@ -855,6 +866,7 @@
if hasChangedGlobs {
fmt.Fprintf(os.Stdout, "Globs changed, rerunning soong...\n")
+ fmt.Fprintf(os.Stdout, "One culprit glob (may be more): %s\n", changedGlobName)
// Write the current time to the glob_results file. We just need
// some unique value to trigger a rerun, it doesn't matter what it is.
err = os.WriteFile(