Fix androidmk module ordering
Java binary modules expect the order of modules in Soong's Android.mk
to match the variant order. Instead of sorting by name and then
subdir, which will alphabetize the variants, only sort by name and
use sort.Stable to keep the ordering of modules with the same name.
Test: m
Change-Id: Icf3d22bdc9f9c73945d01c2c47468cc1c361035d
diff --git a/android/androidmk.go b/android/androidmk.go
index 18b26d9..fc34471 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -72,7 +72,9 @@
androidMkModulesList = append(androidMkModulesList, module)
})
- sort.Sort(ModulesByName{androidMkModulesList, ctx})
+ sort.SliceStable(androidMkModulesList, func(i, j int) bool {
+ return ctx.ModuleName(androidMkModulesList[i]) < ctx.ModuleName(androidMkModulesList[j])
+ })
transMk := PathForOutput(ctx, "Android"+String(ctx.Config().productVariables.Make_suffix)+".mk")
if ctx.Failed() {