Add target/os configurable string_list attrs.

Starting with copts for cc_object, with an extracted function that can
be shared with other cc_* module types.

Test: TH
Change-Id: I9025232e83a3dcd0ca243387486fafbdbd3e2d9b
This commit is contained in:
Jingwen Chen
2021-04-05 10:35:13 +00:00
parent 1a6bbbd990
commit c1c2650532
7 changed files with 209 additions and 71 deletions

View File

@@ -415,12 +415,10 @@ func prettyPrint(propertyValue reflect.Value, indent int) (string, error) {
case reflect.Struct:
// Special cases where the bp2build sends additional information to the codegenerator
// by wrapping the attributes in a custom struct type.
if labels, ok := propertyValue.Interface().(bazel.LabelListAttribute); ok {
return prettyPrintLabelListAttribute(labels, indent)
if attr, ok := propertyValue.Interface().(bazel.Attribute); ok {
return prettyPrintAttribute(attr, indent)
} else if label, ok := propertyValue.Interface().(bazel.Label); ok {
return fmt.Sprintf("%q", label.Label), nil
} else if stringList, ok := propertyValue.Interface().(bazel.StringListAttribute); ok {
return prettyPrintStringListAttribute(stringList, indent)
}
ret = "{\n"