Change the syntax for arch selecting and add os selecting

This changes the syntax from select(variant("arch"), {...}) to
select(arch(), {...}) to make it shorter and to make it clear that
we can restrict what variants you can select on.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: Iafe05b5f455895313a563ed6292f4016b58180b0
This commit is contained in:
Cole Faust
2024-04-11 12:09:44 -07:00
parent fdbf5d476b
commit fc57d40bf1
2 changed files with 36 additions and 13 deletions

View File

@@ -269,11 +269,11 @@ func TestSelects(t *testing.T) {
},
},
{
name: "Select on variant",
name: "Select on arch",
bp: `
my_module_type {
name: "foo",
my_string: select(variant("arch"), {
my_string: select(arch(), {
"x86": "my_x86",
"x86_64": "my_x86_64",
"arm": "my_arm",
@@ -286,6 +286,22 @@ func TestSelects(t *testing.T) {
my_string: proptools.StringPtr("my_arm64"),
},
},
{
name: "Select on os",
bp: `
my_module_type {
name: "foo",
my_string: select(os(), {
"android": "my_android",
"linux": "my_linux",
default: "my_default",
}),
}
`,
provider: selectsTestProvider{
my_string: proptools.StringPtr("my_android"),
},
},
{
name: "Unset value",
bp: `