Add a function to create config_setting(s)
The use case for this is creating config_setting(s) specific to an apex variant and selecting stub/impl in that config_setting. We likely need only a handful of such config_setting(s), but determining that list requires iterating the build graph. Test: go test ./bp2build Change-Id: I9aa552e3d0bcf67513023c3a7d4bbf8fae464ee4
This commit is contained in:
@@ -1898,3 +1898,36 @@ func TestGenerateApiBazelTargets(t *testing.T) {
|
||||
Description: "Generating API contribution Bazel targets for custom module",
|
||||
})
|
||||
}
|
||||
|
||||
func TestGenerateConfigSetting(t *testing.T) {
|
||||
bp := `
|
||||
custom {
|
||||
name: "foo",
|
||||
test_config_setting: true,
|
||||
}
|
||||
`
|
||||
expectedBazelTargets := []string{
|
||||
MakeBazelTargetNoRestrictions(
|
||||
"config_setting",
|
||||
"foo_config_setting",
|
||||
AttrNameToString{
|
||||
"flag_values": `{
|
||||
"//build/bazel/rules/my_string_setting": "foo",
|
||||
}`,
|
||||
},
|
||||
),
|
||||
MakeBazelTarget(
|
||||
"custom",
|
||||
"foo",
|
||||
AttrNameToString{},
|
||||
),
|
||||
}
|
||||
registerCustomModule := func(ctx android.RegistrationContext) {
|
||||
ctx.RegisterModuleType("custom", customModuleFactoryHostAndDevice)
|
||||
}
|
||||
RunBp2BuildTestCase(t, registerCustomModule, Bp2buildTestCase{
|
||||
Blueprint: bp,
|
||||
ExpectedBazelTargets: expectedBazelTargets,
|
||||
Description: "Generating API contribution Bazel targets for custom module",
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user