Merge "Allow common arch for recovery" am: 53b2427fc9 am: b8c9ba16d6

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1569361

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I74a981ddba5ffdf9835669d30a63aa2fe0ecf4de
This commit is contained in:
Inseob Kim
2021-02-04 07:46:42 +00:00
committed by Automerger Merge Worker

View File

@@ -647,10 +647,11 @@ func archMutator(bpctx blueprint.BottomUpMutatorContext) {
} }
// Recovery is always the primary architecture, filter out any other architectures. // Recovery is always the primary architecture, filter out any other architectures.
// Common arch is also allowed
if image == RecoveryVariation { if image == RecoveryVariation {
primaryArch := mctx.Config().DevicePrimaryArchType() primaryArch := mctx.Config().DevicePrimaryArchType()
targets = filterToArch(targets, primaryArch) targets = filterToArch(targets, primaryArch, Common)
multiTargets = filterToArch(multiTargets, primaryArch) multiTargets = filterToArch(multiTargets, primaryArch, Common)
} }
// If there are no supported targets disable the module. // 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 // filterToArch takes a list of Targets and an ArchType, and returns a modified list that contains
// only Targets that have the specified ArchType. // only Targets that have the specified ArchTypes.
func filterToArch(targets []Target, arch ArchType) []Target { func filterToArch(targets []Target, archs ...ArchType) []Target {
for i := 0; i < len(targets); i++ { 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:]...) targets = append(targets[:i], targets[i+1:]...)
i-- i--
} }