Fix nondeterminstic iteration of vndk modules map

Sort the list of libraries when iterating over the vndk modules
map to avoid a non-deterministic output file.

Test: m nothing && mv out/soong/build.ninja /tmp && m nothing && diff -u out/soong/build.ninja /tmp/build.ninja
Change-Id: I889736715dab491bb7e69f3499ab1a5e2c876171
This commit is contained in:
Colin Cross 2019-06-03 15:26:05 -07:00
parent cefa94bd27
commit 4c2c46f0a7

View file

@ -530,8 +530,15 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
var modulePathTxtBuilder strings.Builder
modulePaths := modulePaths(ctx.Config())
var libs []string
for lib := range modulePaths {
libs = append(libs, lib)
}
sort.Strings(libs)
first := true
for lib, dir := range modulePaths(ctx.Config()) {
for _, lib := range libs {
if first {
first = false
} else {
@ -539,7 +546,7 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
}
modulePathTxtBuilder.WriteString(lib)
modulePathTxtBuilder.WriteString(".so ")
modulePathTxtBuilder.WriteString(dir)
modulePathTxtBuilder.WriteString(modulePaths[lib])
}
ctx.Build(pctx, android.BuildParams{