Fix out/soong/Android-<>.mk reproducibility
When there were multiple modules overriding a single module, sometimes we would create the list in different orders, which would trigger some of the later mutators to write the Android-<>.mk out in different orders. Bug: 160207422 Test: diff out/soong/Android-<>.mk between multiple runs on internal master Change-Id: I321db706dd34aa20a0b1556fd282d54b826a4a97
This commit is contained in:
@@ -28,6 +28,7 @@ package android
|
|||||||
// module based on it.
|
// module based on it.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
@@ -161,6 +162,11 @@ func (b *OverridableModuleBase) addOverride(o OverrideModule) {
|
|||||||
|
|
||||||
// Should NOT be used in the same mutator as addOverride.
|
// Should NOT be used in the same mutator as addOverride.
|
||||||
func (b *OverridableModuleBase) getOverrides() []OverrideModule {
|
func (b *OverridableModuleBase) getOverrides() []OverrideModule {
|
||||||
|
b.overridesLock.Lock()
|
||||||
|
sort.Slice(b.overrides, func(i, j int) bool {
|
||||||
|
return b.overrides[i].Name() < b.overrides[j].Name()
|
||||||
|
})
|
||||||
|
b.overridesLock.Unlock()
|
||||||
return b.overrides
|
return b.overrides
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user