Reverse RRO dir paths when passing to Make
LOCAL_RESOURCE_DIRS puts the highest priority overlay first, but
aapt2 expects the highest priority overlay last. Soong stores the
list in aapt2 order (low to high priority), but that means when it
exports to Make as LOCAL_SOONG_RRO_DIRS, which goes to
build_rro_package.mk and then package_internal.mk, it gets reversed
again and comes out backwards.
Bug: 78032566
Test: m checkbuild
Change-Id: If72bf929fbf1d126f9051a2f21ec1eb4e3030e6e
diff --git a/android/paths.go b/android/paths.go
index 87efe53..91dd9a6 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -308,6 +308,18 @@
return list[totalSkip:]
}
+// ReversePaths returns a copy of a Paths in reverse order.
+func ReversePaths(list Paths) Paths {
+ if list == nil {
+ return nil
+ }
+ ret := make(Paths, len(list))
+ for i := range list {
+ ret[i] = list[len(list)-1-i]
+ }
+ return ret
+}
+
func indexPathList(s Path, list []Path) int {
for i, l := range list {
if l == s {