Merge "Reverse RRO dir paths when passing to Make" into pi-dev

This commit is contained in:
TreeHugger Robot 2018-04-19 01:12:40 +00:00 committed by Android (Google) Code Review
commit 74d547d13c
3 changed files with 16 additions and 5 deletions

View file

@ -308,6 +308,18 @@ func LastUniquePaths(list Paths) Paths {
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 {

View file

@ -474,10 +474,7 @@ func TestDirectorySortedPaths(t *testing.T) {
}
paths := makePaths()
reversePaths := make(Paths, len(paths))
for i, v := range paths {
reversePaths[len(paths)-i-1] = v
}
reversePaths := ReversePaths(paths)
sortedPaths := PathsToDirectorySortedPaths(paths)
reverseSortedPaths := PathsToDirectorySortedPaths(reversePaths)

View file

@ -195,7 +195,9 @@ func (app *AndroidApp) AndroidMk() android.AndroidMkData {
}
if len(app.rroDirs) > 0 {
fmt.Fprintln(w, "LOCAL_SOONG_RRO_DIRS :=", strings.Join(app.rroDirs.Strings(), " "))
// Reverse the order, Soong stores rroDirs in aapt2 order (low to high priority), but Make
// expects it in LOCAL_RESOURCE_DIRS order (high to low priority).
fmt.Fprintln(w, "LOCAL_SOONG_RRO_DIRS :=", strings.Join(android.ReversePaths(app.rroDirs).Strings(), " "))
}
if Bool(app.appProperties.Export_package_resources) {