make arch and variant parsing more robust

Post-process the arch and cpu variants to treat the arch name or
"generic" as an empty variant.  Filter out extra empty abis.  Ignore
empty arches.  Print a useful error message when appending properties
fails to find the target field, when an unknown architecture is used, or
when a toolchain has not been implemented for the selected
architecture.

Change-Id: I671d4cd04975f4f29aefc4267b3a624868ce6a75
This commit is contained in:
Colin Cross
2015-11-20 13:07:51 -08:00
parent 6ba99aa281
commit eeabb89426
2 changed files with 34 additions and 8 deletions

View File

@@ -409,8 +409,8 @@ func (c *CCBase) findToolchain(ctx common.AndroidModuleContext) Toolchain {
hod := ctx.HostOrDevice()
factory := toolchainFactories[hod][arch.ArchType]
if factory == nil {
panic(fmt.Sprintf("Toolchain not found for %s arch %q",
hod.String(), arch.String()))
ctx.ModuleErrorf("Toolchain not found for %s arch %q", hod.String(), arch.String())
return nil
}
return factory(arch.ArchVariant, arch.CpuVariant)
}