From 1a0f09bc568ff7b8b306336f032e7fd0b0f6a82e Mon Sep 17 00:00:00 2001 From: Nan Zhang Date: Wed, 5 Jul 2017 10:35:11 -0700 Subject: [PATCH] Fixed the unexpected scenario for "device_supported" cc_defaults { name: boo, device_supported: false, } cc_library_static { name: foo, defaults: [boo], } Soong still tried to build foo_android_arm/arm64 device target which is not what we expected. Test: m -j checkbuild Change-Id: I26a67c9ea024f5458f0818def0fa10cecc5fb7cf --- android/module.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/android/module.go b/android/module.go index 18810fb8f..7f541be29 100644 --- a/android/module.go +++ b/android/module.go @@ -216,12 +216,7 @@ func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib base.commonProperties.ArchSpecific = true switch hod { - case HostAndDeviceSupported: - // Default to module to device supported, host not supported, can override in module - // properties - base.hostAndDeviceProperties.Device_supported = boolPtr(true) - fallthrough - case HostAndDeviceDefault: + case HostAndDeviceSupported, HostAndDeviceDefault: m.AddProperties(&base.hostAndDeviceProperties) } @@ -363,7 +358,8 @@ func (a *ModuleBase) OsClassSupported() []OsClass { if Bool(a.hostAndDeviceProperties.Host_supported) { supported = append(supported, Host, HostCross) } - if Bool(a.hostAndDeviceProperties.Device_supported) { + if a.hostAndDeviceProperties.Device_supported == nil || + *a.hostAndDeviceProperties.Device_supported { supported = append(supported, Device) } return supported @@ -375,7 +371,8 @@ func (a *ModuleBase) OsClassSupported() []OsClass { func (a *ModuleBase) DeviceSupported() bool { return a.commonProperties.HostOrDeviceSupported == DeviceSupported || a.commonProperties.HostOrDeviceSupported == HostAndDeviceSupported && - Bool(a.hostAndDeviceProperties.Device_supported) + (a.hostAndDeviceProperties.Device_supported == nil || + *a.hostAndDeviceProperties.Device_supported) } func (a *ModuleBase) Enabled() bool {