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/selects_test.go b/android/selects_test.go
index 3093deb..e2dc403 100644
--- a/android/selects_test.go
+++ b/android/selects_test.go
@@ -25,12 +25,13 @@
func TestSelects(t *testing.T) {
testCases := []struct {
- name string
- bp string
- provider selectsTestProvider
- providers map[string]selectsTestProvider
- vendorVars map[string]map[string]string
- expectedError string
+ name string
+ bp string
+ provider selectsTestProvider
+ providers map[string]selectsTestProvider
+ vendorVars map[string]map[string]string
+ vendorVarTypes map[string]map[string]string
+ expectedError string
}{
{
name: "basic string list",
@@ -584,6 +585,31 @@
},
},
{
+ name: "Select on boolean soong config variable",
+ bp: `
+ my_module_type {
+ name: "foo",
+ my_string: select(soong_config_variable("my_namespace", "my_variable"), {
+ true: "t",
+ false: "f",
+ }),
+ }
+ `,
+ vendorVars: map[string]map[string]string{
+ "my_namespace": {
+ "my_variable": "true",
+ },
+ },
+ vendorVarTypes: map[string]map[string]string{
+ "my_namespace": {
+ "my_variable": "bool",
+ },
+ },
+ provider: selectsTestProvider{
+ my_string: proptools.StringPtr("t"),
+ },
+ },
+ {
name: "Select on boolean false",
bp: `
my_module_type {
@@ -813,6 +839,7 @@
}),
FixtureModifyProductVariables(func(variables FixtureProductVariables) {
variables.VendorVars = tc.vendorVars
+ variables.VendorVarTypes = tc.vendorVarTypes
}),
)
if tc.expectedError != "" {