From 33c7736936b2f777dc93bc26cbcbda56c0c144b7 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Fri, 29 May 2020 22:00:16 +0900 Subject: [PATCH] Notice file embededd in APEX is deterministic Bug: 157724521 Test: m Change-Id: I25f6cd9dd0679af6acfc2594314d11fa53ae2151 --- android/paths.go | 9 +++++++++ apex/builder.go | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/android/paths.go b/android/paths.go index fcea65c55..3ad27acbe 100644 --- a/android/paths.go +++ b/android/paths.go @@ -485,6 +485,15 @@ func FirstUniquePaths(list Paths) Paths { return firstUniquePathsList(list) } +// SortedUniquePaths returns what its name says +func SortedUniquePaths(list Paths) Paths { + unique := FirstUniquePaths(list) + sort.Slice(unique, func(i, j int) bool { + return unique[i].String() < unique[j].String() + }) + return unique +} + func firstUniquePathsList(list Paths) Paths { k := 0 outer: diff --git a/apex/builder.go b/apex/builder.go index a6a347b5f..a7053dcf1 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -247,7 +247,7 @@ func (a *apexBundle) buildNoticeFiles(ctx android.ModuleContext, apexFileName st return android.NoticeOutputs{} } - return android.BuildNoticeOutput(ctx, a.installDir, apexFileName, android.FirstUniquePaths(noticeFiles)) + return android.BuildNoticeOutput(ctx, a.installDir, apexFileName, android.SortedUniquePaths(noticeFiles)) } func (a *apexBundle) buildInstalledFilesFile(ctx android.ModuleContext, builtApex android.Path, imageDir android.Path) android.OutputPath {