From 20fb5d4e24f93187c898711345c217f7c88e65c1 Mon Sep 17 00:00:00 2001 From: Inseob Kim Date: Tue, 2 Feb 2021 20:07:58 +0900 Subject: [PATCH] Allow common arch for recovery Test: build Change-Id: I9cffd399e0d00b53c344aac6045eadcf5be78cb3 --- android/arch.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/android/arch.go b/android/arch.go index baee9be26..abcdbbba5 100644 --- a/android/arch.go +++ b/android/arch.go @@ -647,10 +647,11 @@ func archMutator(bpctx blueprint.BottomUpMutatorContext) { } // Recovery is always the primary architecture, filter out any other architectures. + // Common arch is also allowed if image == RecoveryVariation { primaryArch := mctx.Config().DevicePrimaryArchType() - targets = filterToArch(targets, primaryArch) - multiTargets = filterToArch(multiTargets, primaryArch) + targets = filterToArch(targets, primaryArch, Common) + multiTargets = filterToArch(multiTargets, primaryArch, Common) } // If there are no supported targets disable the module. @@ -719,10 +720,17 @@ func decodeMultilib(base *ModuleBase, class OsClass) (multilib, extraMultilib st } // filterToArch takes a list of Targets and an ArchType, and returns a modified list that contains -// only Targets that have the specified ArchType. -func filterToArch(targets []Target, arch ArchType) []Target { +// only Targets that have the specified ArchTypes. +func filterToArch(targets []Target, archs ...ArchType) []Target { for i := 0; i < len(targets); i++ { - if targets[i].Arch.ArchType != arch { + found := false + for _, arch := range archs { + if targets[i].Arch.ArchType == arch { + found = true + break + } + } + if !found { targets = append(targets[:i], targets[i+1:]...) i-- }