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
diff --git a/android/module.go b/android/module.go
index b438150..9c7410c 100644
--- a/android/module.go
+++ b/android/module.go
@@ -2253,7 +2253,20 @@
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()