Merge "Allow soong config variables to be boolean-typed" into main

This commit is contained in:
Cole Faust
2024-06-21 01:21:25 +00:00
committed by Gerrit Code Review
3 changed files with 49 additions and 8 deletions

View File

@@ -2253,7 +2253,20 @@ func (e configurationEvalutor) EvaluateConfiguration(condition proptools.Configu
variable := condition.Arg(1)
if n, ok := ctx.Config().productVariables.VendorVars[namespace]; ok {
if v, ok := n[variable]; ok {
return proptools.ConfigurableValueString(v)
ty := ""
if namespaces, ok := ctx.Config().productVariables.VendorVarTypes[namespace]; ok {
ty = namespaces[variable]
}
switch ty {
case "":
// strings are the default, we don't bother writing them to the soong variables json file
return proptools.ConfigurableValueString(v)
case "bool":
return proptools.ConfigurableValueBool(v == "true")
default:
panic("unhandled soong config variable type: " + ty)
}
}
}
return proptools.ConfigurableValueUndefined()