Merge "android: Use slices.DeleteFunc for filtering" into main

This commit is contained in:
Ivan Lozano
2024-07-18 17:27:34 +00:00
committed by Gerrit Code Review

View File

@@ -19,6 +19,7 @@ import (
"fmt" "fmt"
"reflect" "reflect"
"runtime" "runtime"
"slices"
"strings" "strings"
"github.com/google/blueprint" "github.com/google/blueprint"
@@ -592,26 +593,16 @@ func archMutator(bpctx blueprint.BottomUpMutatorContext) {
// Filter NativeBridge targets unless they are explicitly supported. // Filter NativeBridge targets unless they are explicitly supported.
// Skip creating native bridge variants for non-core modules. // Skip creating native bridge variants for non-core modules.
if os == Android && !(base.IsNativeBridgeSupported() && image == CoreVariation) { if os == Android && !(base.IsNativeBridgeSupported() && image == CoreVariation) {
osTargets = slices.DeleteFunc(slices.Clone(osTargets), func(t Target) bool {
var targets []Target return bool(t.NativeBridge)
for _, t := range osTargets { })
if !t.NativeBridge {
targets = append(targets, t)
}
}
osTargets = targets
} }
// Filter HostCross targets if disabled. // Filter HostCross targets if disabled.
if base.HostSupported() && !base.HostCrossSupported() { if base.HostSupported() && !base.HostCrossSupported() {
var targets []Target osTargets = slices.DeleteFunc(slices.Clone(osTargets), func(t Target) bool {
for _, t := range osTargets { return t.HostCross
if !t.HostCross { })
targets = append(targets, t)
}
}
osTargets = targets
} }
// only the primary arch in the ramdisk / vendor_ramdisk / recovery partition // only the primary arch in the ramdisk / vendor_ramdisk / recovery partition