From 56060290077a28257760e10fdf7894b99eb397a3 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Sat, 15 May 2021 19:34:05 +0100 Subject: [PATCH] Order apex files by destination path not source path The destination path, i.e. the path the file will occupy in the APEX is more stable and less likely to change than the source path, i.e. the path of the file in the out or source directories. This makes it easier to diff changes in the copy commands. Bug: 179354495 Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt - verify that this does not change the contents of the apex files - verify that this does change the order of copy_commands for the above apexes Change-Id: Ia9ebe8418c59903cd738ee0fb9262b3f32a4ddbf --- apex/apex.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apex/apex.go b/apex/apex.go index 26ac457ea..a8fbf2274 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -1980,7 +1980,9 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { // Sort to have consistent build rules sort.Slice(filesInfo, func(i, j int) bool { - return filesInfo[i].builtFile.String() < filesInfo[j].builtFile.String() + // Sort by destination path so as to ensure consistent ordering even if the source of the files + // changes. + return filesInfo[i].path() < filesInfo[j].path() }) ////////////////////////////////////////////////////////////////////////////////////////////