diff options
author | Dan Willemsen <dwillemsen@google.com> | 2016-07-11 14:36:48 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2016-07-11 14:36:48 -0700 |
commit | 3f32f03067446f223c488f56fd1fbc633febc1fd (patch) | |
tree | 3a137b3f77ec6a64e2a3c501d559e241bfc9eccb /android/arch.go | |
parent | 76f0827ce34cd4335037b90f6e6d430ec6d265fb (diff) | |
download | build_soong-3f32f03067446f223c488f56fd1fbc633febc1fd.tar.gz build_soong-3f32f03067446f223c488f56fd1fbc633febc1fd.tar.bz2 build_soong-3f32f03067446f223c488f56fd1fbc633febc1fd.zip |
Support no configured device architectures
There are some builds where we only want to build host tools, and we may
not have a valid device configuration. Support 0 device architectures
and modules that don't have any configured way to build.
Change-Id: I732251e1cd3cdbfafbc6ef6a550e33e653876f7c
Diffstat (limited to 'android/arch.go')
-rw-r--r-- | android/arch.go | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/android/arch.go b/android/arch.go index 0673249d..08b7b1f8 100644 --- a/android/arch.go +++ b/android/arch.go @@ -435,6 +435,11 @@ func ArchMutator(mctx BottomUpMutatorContext) { moduleTargets = append(moduleTargets, targets...) } + if len(moduleTargets) == 0 { + module.base().commonProperties.Enabled = boolPtr(false) + return + } + targetNames := make([]string, len(moduleTargets)) for i, target := range moduleTargets { @@ -762,21 +767,19 @@ func decodeTargetProductVariables(config Config) (map[OsClass][]Target, error) { } } - if variables.DeviceArch == nil { - return nil, fmt.Errorf("No device primary architecture set") - } - - addTarget(Android, *variables.DeviceArch, variables.DeviceArchVariant, - variables.DeviceCpuVariant, variables.DeviceAbi) + if variables.DeviceArch != nil && *variables.DeviceArch != "" { + addTarget(Android, *variables.DeviceArch, variables.DeviceArchVariant, + variables.DeviceCpuVariant, variables.DeviceAbi) - if variables.DeviceSecondaryArch != nil && *variables.DeviceSecondaryArch != "" { - addTarget(Android, *variables.DeviceSecondaryArch, - variables.DeviceSecondaryArchVariant, variables.DeviceSecondaryCpuVariant, - variables.DeviceSecondaryAbi) + if variables.DeviceSecondaryArch != nil && *variables.DeviceSecondaryArch != "" { + addTarget(Android, *variables.DeviceSecondaryArch, + variables.DeviceSecondaryArchVariant, variables.DeviceSecondaryCpuVariant, + variables.DeviceSecondaryAbi) - deviceArches := targets[Device] - if deviceArches[0].Arch.ArchType.Multilib == deviceArches[1].Arch.ArchType.Multilib { - deviceArches[1].Arch.Native = false + deviceArches := targets[Device] + if deviceArches[0].Arch.ArchType.Multilib == deviceArches[1].Arch.ArchType.Multilib { + deviceArches[1].Arch.Native = false + } } } |