Allow soong config variables to be boolean-typed

So that you can use `true` instead of `"true"` in select expressions.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I950bd8e04f8fab5187ea5075514d476227943f33
This commit is contained in:
Cole Faust
2024-06-20 12:57:43 -07:00
parent 26faf1b321
commit 46f6e2f1aa
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()