Support enabled
flag in product variable config
Some Android.bp modules have `enabled: false` but only use a product variable such as `source_build` to enable the module. Currently b2build does not handle this case at all. This commit adds the functionality to support this use case. Also, remove `__enabled` suffix in ProductVariable SelectKey. Bug: 210546943 Test: go test ./bp2build Topic: use_enabled_flag_product_variable_config Change-Id: I459c17a84c172df010666391066bf4d11d19253e
This commit is contained in:
@@ -601,10 +601,16 @@ func (p *ProductConfigProperty) SelectKey() string {
|
||||
|
||||
value := p.FullConfig
|
||||
if value == p.Name {
|
||||
value = "enabled"
|
||||
value = ""
|
||||
}
|
||||
// e.g. acme__feature1__enabled, android__board__soc_a
|
||||
return strings.ToLower(strings.Join([]string{p.Namespace, p.Name, value}, "__"))
|
||||
|
||||
// e.g. acme__feature1, android__board__soc_a
|
||||
selectKey := strings.ToLower(strings.Join([]string{p.Namespace, p.Name}, "__"))
|
||||
if value != "" {
|
||||
selectKey = strings.ToLower(strings.Join([]string{selectKey, value}, "__"))
|
||||
}
|
||||
|
||||
return selectKey
|
||||
}
|
||||
|
||||
// ProductConfigProperties is a map of maps to group property values according
|
||||
|
Reference in New Issue
Block a user