From e03ab89d8a11d78ff6f0e4fb7cb98d91a634693d Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Fri, 17 Jan 2025 13:55:04 -0800 Subject: 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 --- filesystem/filesystem.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'filesystem/filesystem.go') 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, -- cgit v1.2.3-59-g8ed1b