diff options
author | 2024-02-05 22:06:54 +0000 | |
---|---|---|
committer | 2024-02-05 22:11:28 +0000 | |
commit | 2268cd8b8b59894e8048ae55eba61aa851b0550f (patch) | |
tree | 6346d4ee5742f438244128b332f4a02b06cf218c /android/all_teams.go | |
parent | bb0d5866c56a7d9393fd48f99ef2edf063f0c218 (diff) |
Fix non-determinism in all_teams.pb
this.teams_for_mods uses a dictionary and `range` yields a
non-deterministic ordering. This would cause all_teams.pb to be
non-determinisitic. Since this file is created during Soong analysis, it
would cause the .ninja file to also be non-deterministic.
Use SortedKeys to do the iteration instead.
Test: go build ./android
Test: m nothing a couple of times and checked that the .ninja files are
identical
Change-Id: Ife2d2520d118ef25639f86390912d98b5f057655
Diffstat (limited to 'android/all_teams.go')
-rw-r--r-- | android/all_teams.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/android/all_teams.go b/android/all_teams.go index 6c3a219ab..dd7d2db33 100644 --- a/android/all_teams.go +++ b/android/all_teams.go @@ -118,8 +118,8 @@ func (this *allTeamsSingleton) MakeVars(ctx MakeVarsContext) { // either the declared team data for that module or the package default team data for that module. func (this *allTeamsSingleton) lookupTeamForAllModules() *team_proto.AllTeams { teamsProto := make([]*team_proto.Team, len(this.teams_for_mods)) - i := 0 - for moduleName, m := range this.teams_for_mods { + for i, moduleName := range SortedKeys(this.teams_for_mods) { + m, _ := this.teams_for_mods[moduleName] teamName := m.teamName var teamProperties teamProperties found := false @@ -152,7 +152,6 @@ func (this *allTeamsSingleton) lookupTeamForAllModules() *team_proto.AllTeams { } } teamsProto[i] = teamData - i++ } return &team_proto.AllTeams{Teams: teamsProto} } |