Split asm and c flags and srcs in bp2build output
This allows removal of almost all current items from the mixed build denylist, which were previously broken due to being unable to separately control flags for compilations of different languages within the same target. Note that this does not appropriately implement asm/c srcs and flags for either the shared variant or the static variant. This will require a followup. Test: bp2build.sh and mixed_libc.sh CI scripts Test: Updated b2build tests Change-Id: I28cf7437ee96cdf2fdbcb1eda2303691cff08ba4
This commit is contained in:
@@ -137,6 +137,54 @@ func SubtractStrings(haystack []string, needle []string) []string {
|
||||
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
|
||||
|
Reference in New Issue
Block a user