android: Add host_cross_supported prop

Some modules are only intended to be build for the build host,
e.g. rust_library modules only used in rust_proc_macro or
code generators.

These should not be expected to be built for or supported on non-build
host platforms. Thus, add a host_cross_supported property to disable
the HostCross target.

Test: m blueprint_tests
Test: Modules with host_cross_supported: false don't build for HostCross
Change-Id: Ia15f55776e04d86aee19bb0dd0d27e1b985b2b75
This commit is contained in:
Ivan Lozano
2024-07-16 17:55:33 +00:00
parent 397db9d336
commit c7eafa7a41
3 changed files with 48 additions and 8 deletions

View File

@@ -587,6 +587,7 @@ func archMutator(bpctx blueprint.BottomUpMutatorContext) {
}
osTargets := mctx.Config().Targets[os]
image := base.commonProperties.ImageVariation
// Filter NativeBridge targets unless they are explicitly supported.
// Skip creating native bridge variants for non-core modules.
@@ -602,6 +603,17 @@ func archMutator(bpctx blueprint.BottomUpMutatorContext) {
osTargets = targets
}
// Filter HostCross targets if disabled.
if base.HostSupported() && !base.HostCrossSupported() {
var targets []Target
for _, t := range osTargets {
if !t.HostCross {
targets = append(targets, t)
}
}
osTargets = targets
}
// only the primary arch in the ramdisk / vendor_ramdisk / recovery partition
if os == Android && (module.InstallInRecovery() || module.InstallInRamdisk() || module.InstallInVendorRamdisk() || module.InstallInDebugRamdisk()) {
osTargets = []Target{osTargets[0]}