Merge "Revert "Parallelize VerifyProvidersWereUnchanged"" into main am: 6daa49ee97 am: c3b4357792

Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/3101711

Change-Id: I0c17b4d23784eda583eca22f33d441b402d94763
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Priyanka Advani 2024-05-24 00:45:40 +00:00 committed by Automerger Merge Worker
commit b26be9398c

View file

@ -4144,12 +4144,8 @@ func (c *Context) VerifyProvidersWereUnchanged() []error {
if !c.buildActionsReady {
return []error{ErrBuildActionsNotReady}
}
errorCh := make(chan []error)
doneCh := make(chan []error)
go func() {
doneCh <- parallelVisit(c.modulesSorted, unorderedVisitorImpl{}, parallelVisitLimit,
func(m *moduleInfo, pause chan<- pauseSpec) bool {
var errors []error
for _, m := range c.modulesSorted {
for i, provider := range m.providers {
if provider != nil {
hash, err := proptools.HashProvider(provider)
@ -4157,7 +4153,7 @@ func (c *Context) VerifyProvidersWereUnchanged() []error {
errors = append(errors, fmt.Errorf("provider %q on module %q was modified after being set, and no longer hashable afterwards: %s", providerRegistry[i].typ, m.Name(), err.Error()))
continue
}
if m.providerInitialValueHashes[i] != hash {
if provider != nil && m.providerInitialValueHashes[i] != hash {
errors = append(errors, fmt.Errorf("provider %q on module %q was modified after being set", providerRegistry[i].typ, m.Name()))
}
} else if m.providerInitialValueHashes[i] != 0 {
@ -4165,25 +4161,7 @@ func (c *Context) VerifyProvidersWereUnchanged() []error {
errors = append(errors, fmt.Errorf("provider %q on module %q was unset somehow, this is an internal error", providerRegistry[i].typ, m.Name()))
}
}
if errors != nil {
errorCh <- errors
}
return false
})
}()
var errors []error
done := false
for !done {
select {
case newErrors := <-doneCh:
errors = append(errors, newErrors...)
done = true
case newErrors := <-errorCh:
errors = append(errors, newErrors...)
}
}
return errors
}