Rollforward "Split asm and c flags and srcs in..."
This fixes a test and rolls forward I28cf7437ee96cdf2fdbcb1eda2303691cff08ba4
Test: m nothing
Test: See I28cf7437ee96cdf2fdbcb1eda2303691cff08ba4
Change-Id: I0e450c28e70087e406e7b562d7e772785f177379
diff --git a/bazel/properties.go b/bazel/properties.go
index 84dca7e..6ecf6ca 100644
--- a/bazel/properties.go
+++ b/bazel/properties.go
@@ -137,6 +137,54 @@
return strings
}
+// Return all needles in a given haystack, where needleFn is true for needles.
+func FilterLabelList(haystack LabelList, needleFn func(string) bool) LabelList {
+ var includes []Label
+
+ for _, inc := range haystack.Includes {
+ if needleFn(inc.Label) {
+ includes = append(includes, inc)
+ }
+ }
+ return LabelList{Includes: includes, Excludes: haystack.Excludes}
+}
+
+// Return all needles in a given haystack, where needleFn is true for needles.
+func FilterLabelListAttribute(haystack LabelListAttribute, needleFn func(string) bool) LabelListAttribute {
+ var result LabelListAttribute
+
+ result.Value = FilterLabelList(haystack.Value, needleFn)
+
+ for arch := range PlatformArchMap {
+ result.SetValueForArch(arch, FilterLabelList(haystack.GetValueForArch(arch), needleFn))
+ }
+
+ for os := range PlatformOsMap {
+ result.SetValueForOS(os, FilterLabelList(haystack.GetValueForOS(os), needleFn))
+ }
+
+ return result
+}
+
+// Subtract needle from haystack
+func SubtractBazelLabelListAttribute(haystack LabelListAttribute, needle LabelListAttribute) LabelListAttribute {
+ var result LabelListAttribute
+
+ for arch := range PlatformArchMap {
+ result.SetValueForArch(arch,
+ SubtractBazelLabelList(haystack.GetValueForArch(arch), needle.GetValueForArch(arch)))
+ }
+
+ for os := range PlatformOsMap {
+ result.SetValueForOS(os,
+ SubtractBazelLabelList(haystack.GetValueForOS(os), needle.GetValueForOS(os)))
+ }
+
+ result.Value = SubtractBazelLabelList(haystack.Value, needle.Value)
+
+ return result
+}
+
// Subtract needle from haystack
func SubtractBazelLabels(haystack []Label, needle []Label) []Label {
// This is really a set