Fix //conditions:default excludes computation for LabelListAttribute.
Previously, excludes computation for the default condition in label list
selects was clobbering pre-existing values. This CL fixes it by
performing a union of the new values with existing ones instead.
Test: properties_test.go
Bug: 198556411
Change-Id: Id11f4fb14e359201304afde0d8ba856851d41395
diff --git a/bazel/properties.go b/bazel/properties.go
index 6a06c1b..facbedd 100644
--- a/bazel/properties.go
+++ b/bazel/properties.go
@@ -534,9 +534,13 @@
lla.ConfigurableValues[axis][config] = SubtractBazelLabelList(val, lla.Value)
}
- // Now that the Value list is finalized for this axis, compare it with the original
- // list, and put the difference into the default condition for the axis.
- lla.ConfigurableValues[axis][ConditionsDefaultConfigKey] = SubtractBazelLabelList(baseLabels, lla.Value)
+ // Now that the Value list is finalized for this axis, compare it with
+ // the original list, and union the difference with the default
+ // condition for the axis.
+ difference := SubtractBazelLabelList(baseLabels, lla.Value)
+ existingDefaults := lla.ConfigurableValues[axis][ConditionsDefaultConfigKey]
+ existingDefaults.Append(difference)
+ lla.ConfigurableValues[axis][ConditionsDefaultConfigKey] = FirstUniqueBazelLabelList(existingDefaults)
// if everything ends up without includes, just delete the axis
if !lla.ConfigurableValues[axis].HasConfigurableValues() {