Add variant_prepend support for all the properties in bp2build
This is a follow up of aosp/2336916. All the properties that have
variant_prepend tag are supported in bp2build.
Bug: 261644490
Test: TH and modified tests with updated expected behaviors
Change-Id: I13bb5d4d8fcd38bf153fa9083c9c945aec2dfa19
diff --git a/bp2build/configurability.go b/bp2build/configurability.go
index c630965..987c903 100644
--- a/bp2build/configurability.go
+++ b/bp2build/configurability.go
@@ -106,8 +106,9 @@
return value, []selects{ret}
}
-func getLabelListValues(list bazel.LabelListAttribute) (reflect.Value, []selects) {
+func getLabelListValues(list bazel.LabelListAttribute) (reflect.Value, []selects, bool) {
value := reflect.ValueOf(list.Value.Includes)
+ prepend := list.Prepend
var ret []selects
for _, axis := range list.SortedConfigurationAxes() {
configToLabels := list.ConfigurableValues[axis]
@@ -133,7 +134,7 @@
}
}
- return value, ret
+ return value, ret, prepend
}
func labelListSelectValue(selectKey string, list bazel.LabelList, emitEmptyList bool) (bool, reflect.Value) {
@@ -173,7 +174,7 @@
value, configurableAttrs, prepend = getStringListValues(list)
defaultSelectValue = &emptyBazelList
case bazel.LabelListAttribute:
- value, configurableAttrs = getLabelListValues(list)
+ value, configurableAttrs, prepend = getLabelListValues(list)
emitZeroValues = list.EmitEmptyList
defaultSelectValue = &emptyBazelList
if list.ForceSpecifyEmptyList && (!value.IsNil() || list.HasConfigurableValues()) {