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
diff --git a/android/arch.go b/android/arch.go
index e0c6908..251990b 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -587,6 +587,7 @@
}
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 @@
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]}