summaryrefslogtreecommitdiff
path: root/android/override_module.go
diff options
context:
space:
mode:
author Dan Willemsen <dwillemsen@google.com> 2020-06-29 23:49:34 -0700
committer Dan Willemsen <dwillemsen@google.com> 2020-07-01 15:13:58 -0700
commit1a8c8565bd1f77eea5caf9368594f132ccaa5faf (patch)
treed216f3402211d20b590ec75cd475888d2985cb95 /android/override_module.go
parenta66f571e010fef50d0680cd54e8afa944c3859ac (diff)
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
Diffstat (limited to 'android/override_module.go')
-rw-r--r--android/override_module.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/android/override_module.go b/android/override_module.go
index 6b246db41..3994084a8 100644
--- a/android/override_module.go
+++ b/android/override_module.go
@@ -28,6 +28,7 @@ package android
// module based on it.
import (
+ "sort"
"sync"
"github.com/google/blueprint"
@@ -161,6 +162,11 @@ func (b *OverridableModuleBase) addOverride(o OverrideModule) {
// Should NOT be used in the same mutator as addOverride.
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
}