diff options
author | 2025-01-17 13:55:04 -0800 | |
---|---|---|
committer | 2025-01-17 13:55:04 -0800 | |
commit | e03ab89d8a11d78ff6f0e4fb7cb98d91a634693d (patch) | |
tree | 6d6f16f918e6c9d46c09079177572ad27bce5831 /filesystem/filesystem.go | |
parent | b15ead941d7575bfc91841f23c26c99413bb9864 (diff) |
Sort lines in property file
Make also sorts the lines, sort them in soong so it's easier to
compare.
Bug: 376727180
Test: m --soong-only
Change-Id: I9a5e61a9348a7d2ff5058260768e89065a06e7c8
Diffstat (limited to 'filesystem/filesystem.go')
-rw-r--r-- | filesystem/filesystem.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index 822ba43ad..6037724dc 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -20,6 +20,7 @@ import ( "io" "path/filepath" "slices" + "sort" "strconv" "strings" @@ -744,12 +745,9 @@ func (f *filesystem) buildFileContexts(ctx android.ModuleContext) android.Path { func (f *filesystem) buildPropFile(ctx android.ModuleContext) (android.Path, android.Paths) { var deps android.Paths - var propFileString strings.Builder + var lines []string addStr := func(name string, value string) { - propFileString.WriteString(name) - propFileString.WriteRune('=') - propFileString.WriteString(value) - propFileString.WriteRune('\n') + lines = append(lines, fmt.Sprintf("%s=%s", name, value)) } addPath := func(name string, path android.Path) { addStr(name, path.String()) @@ -879,8 +877,10 @@ func (f *filesystem) buildPropFile(ctx android.ModuleContext) (android.Path, and addStr("needs_compress", "1") } + sort.Strings(lines) + propFilePreProcessing := android.PathForModuleOut(ctx, "prop_pre_processing") - android.WriteFileRuleVerbatim(ctx, propFilePreProcessing, propFileString.String()) + android.WriteFileRule(ctx, propFilePreProcessing, strings.Join(lines, "\n")) propFile := android.PathForModuleOut(ctx, "prop") ctx.Build(pctx, android.BuildParams{ Rule: textFileProcessorRule, |