Merge "Revert "Parallelize VerifyProvidersWereUnchanged"" into main am: 6daa49ee97
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/3101711 Change-Id: I67ad62338b2cb429c6390e8b9451766a5a38b1dc Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
c3b4357792
1 changed files with 15 additions and 37 deletions
52
context.go
52
context.go
|
@ -4144,46 +4144,24 @@ func (c *Context) VerifyProvidersWereUnchanged() []error {
|
||||||
if !c.buildActionsReady {
|
if !c.buildActionsReady {
|
||||||
return []error{ErrBuildActionsNotReady}
|
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 i, provider := range m.providers {
|
|
||||||
if provider != nil {
|
|
||||||
hash, err := proptools.HashProvider(provider)
|
|
||||||
if err != nil {
|
|
||||||
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 {
|
|
||||||
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 {
|
|
||||||
// This should be unreachable, because in setProvider we check if the provider has already been set.
|
|
||||||
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
|
var errors []error
|
||||||
done := false
|
for _, m := range c.modulesSorted {
|
||||||
for !done {
|
for i, provider := range m.providers {
|
||||||
select {
|
if provider != nil {
|
||||||
case newErrors := <-doneCh:
|
hash, err := proptools.HashProvider(provider)
|
||||||
errors = append(errors, newErrors...)
|
if err != nil {
|
||||||
done = true
|
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()))
|
||||||
case newErrors := <-errorCh:
|
continue
|
||||||
errors = append(errors, newErrors...)
|
}
|
||||||
|
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 {
|
||||||
|
// This should be unreachable, because in setProvider we check if the provider has already been set.
|
||||||
|
errors = append(errors, fmt.Errorf("provider %q on module %q was unset somehow, this is an internal error", providerRegistry[i].typ, m.Name()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return errors
|
return errors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue