Fix some non-determinism in aconfigMerge operation

Sorted iteration ensures that `mergeAconfigFiles` generates the ninja
rules in a deterministic fashion.

Test: mv out/soong/build.ninja; regenerate; compare; bit-identical
after this change

Change-Id: Ic9bee14374fa1eb7adee670eaed42ad6ffdd9010
This commit is contained in:
Spandan Das 2024-03-28 21:22:37 +00:00
parent 2590054333
commit 87f5ee4cb6

View file

@ -105,7 +105,8 @@ func CollectDependencyAconfigFiles(ctx ModuleContext, mergedAconfigFiles *map[st
}
})
for container, aconfigFiles := range *mergedAconfigFiles {
for _, container := range SortedKeys(*mergedAconfigFiles) {
aconfigFiles := (*mergedAconfigFiles)[container]
(*mergedAconfigFiles)[container] = mergeAconfigFiles(ctx, container, aconfigFiles, false)
}
@ -172,7 +173,8 @@ func aconfigUpdateAndroidBuildActions(ctx ModuleContext) {
})
// We only need to set the provider if we have aconfig files.
if len(mergedAconfigFiles) > 0 {
for container, aconfigFiles := range mergedAconfigFiles {
for _, container := range SortedKeys(mergedAconfigFiles) {
aconfigFiles := mergedAconfigFiles[container]
mergedAconfigFiles[container] = mergeAconfigFiles(ctx, container, aconfigFiles, true)
}