2021-02-24 13:20:12 +01:00
|
|
|
package bp2build
|
|
|
|
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"reflect"
|
2021-12-10 00:10:18 +01:00
|
|
|
|
|
|
|
"android/soong/android"
|
|
|
|
"android/soong/bazel"
|
2022-02-03 14:42:10 +01:00
|
|
|
"android/soong/starlark_fmt"
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
)
|
2021-02-24 13:20:12 +01:00
|
|
|
|
|
|
|
// Configurability support for bp2build.
|
|
|
|
|
2021-04-05 12:35:13 +02:00
|
|
|
type selects map[string]reflect.Value
|
|
|
|
|
2022-06-23 18:02:44 +02:00
|
|
|
func getStringValue(str bazel.StringAttribute) (reflect.Value, []selects) {
|
|
|
|
value := reflect.ValueOf(str.Value)
|
|
|
|
|
|
|
|
if !str.HasConfigurableValues() {
|
|
|
|
return value, []selects{}
|
|
|
|
}
|
|
|
|
|
|
|
|
ret := selects{}
|
|
|
|
for _, axis := range str.SortedConfigurationAxes() {
|
|
|
|
configToStrs := str.ConfigurableValues[axis]
|
|
|
|
for config, strs := range configToStrs {
|
|
|
|
selectKey := axis.SelectKey(config)
|
|
|
|
ret[selectKey] = reflect.ValueOf(strs)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if there is a select, use the base value as the conditions default value
|
|
|
|
if len(ret) > 0 {
|
|
|
|
ret[bazel.ConditionsDefaultSelectKey] = value
|
|
|
|
value = reflect.Zero(value.Type())
|
|
|
|
}
|
|
|
|
|
|
|
|
return value, []selects{ret}
|
|
|
|
}
|
|
|
|
|
2022-12-10 01:08:54 +01:00
|
|
|
func getStringListValues(list bazel.StringListAttribute) (reflect.Value, []selects, bool) {
|
2021-04-05 12:35:13 +02:00
|
|
|
value := reflect.ValueOf(list.Value)
|
2022-12-28 20:18:11 +01:00
|
|
|
prepend := list.Prepend
|
2021-04-05 12:35:13 +02:00
|
|
|
if !list.HasConfigurableValues() {
|
2022-12-10 01:08:54 +01:00
|
|
|
return value, []selects{}, prepend
|
2021-04-05 12:35:13 +02:00
|
|
|
}
|
|
|
|
|
2021-05-21 14:37:59 +02:00
|
|
|
var ret []selects
|
|
|
|
for _, axis := range list.SortedConfigurationAxes() {
|
|
|
|
configToLists := list.ConfigurableValues[axis]
|
|
|
|
archSelects := map[string]reflect.Value{}
|
|
|
|
for config, labels := range configToLists {
|
|
|
|
selectKey := axis.SelectKey(config)
|
|
|
|
archSelects[selectKey] = reflect.ValueOf(labels)
|
2021-05-19 12:49:02 +02:00
|
|
|
}
|
2021-05-21 14:37:59 +02:00
|
|
|
if len(archSelects) > 0 {
|
|
|
|
ret = append(ret, archSelects)
|
2021-05-06 19:54:29 +02:00
|
|
|
}
|
|
|
|
}
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
|
2022-12-10 01:08:54 +01:00
|
|
|
return value, ret, prepend
|
2021-04-05 12:35:13 +02:00
|
|
|
}
|
|
|
|
|
2021-05-06 19:54:29 +02:00
|
|
|
func getLabelValue(label bazel.LabelAttribute) (reflect.Value, []selects) {
|
2021-05-27 08:15:54 +02:00
|
|
|
value := reflect.ValueOf(label.Value)
|
|
|
|
if !label.HasConfigurableValues() {
|
|
|
|
return value, []selects{}
|
|
|
|
}
|
|
|
|
|
2021-05-21 14:37:59 +02:00
|
|
|
ret := selects{}
|
|
|
|
for _, axis := range label.SortedConfigurationAxes() {
|
|
|
|
configToLabels := label.ConfigurableValues[axis]
|
|
|
|
for config, labels := range configToLabels {
|
|
|
|
selectKey := axis.SelectKey(config)
|
|
|
|
ret[selectKey] = reflect.ValueOf(labels)
|
2021-05-27 08:15:54 +02:00
|
|
|
}
|
|
|
|
}
|
2021-05-12 12:36:45 +02:00
|
|
|
|
2021-10-04 19:44:34 +02:00
|
|
|
// if there is a select, use the base value as the conditions default value
|
|
|
|
if len(ret) > 0 {
|
|
|
|
ret[bazel.ConditionsDefaultSelectKey] = value
|
|
|
|
value = reflect.Zero(value.Type())
|
|
|
|
}
|
|
|
|
|
2021-05-21 14:37:59 +02:00
|
|
|
return value, []selects{ret}
|
2021-04-30 15:35:09 +02:00
|
|
|
}
|
|
|
|
|
2021-06-03 19:43:01 +02:00
|
|
|
func getBoolValue(boolAttr bazel.BoolAttribute) (reflect.Value, []selects) {
|
|
|
|
value := reflect.ValueOf(boolAttr.Value)
|
|
|
|
if !boolAttr.HasConfigurableValues() {
|
|
|
|
return value, []selects{}
|
|
|
|
}
|
|
|
|
|
|
|
|
ret := selects{}
|
|
|
|
for _, axis := range boolAttr.SortedConfigurationAxes() {
|
|
|
|
configToBools := boolAttr.ConfigurableValues[axis]
|
|
|
|
for config, bools := range configToBools {
|
|
|
|
selectKey := axis.SelectKey(config)
|
|
|
|
ret[selectKey] = reflect.ValueOf(bools)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if there is a select, use the base value as the conditions default value
|
|
|
|
if len(ret) > 0 {
|
|
|
|
ret[bazel.ConditionsDefaultSelectKey] = value
|
|
|
|
value = reflect.Zero(value.Type())
|
|
|
|
}
|
|
|
|
|
|
|
|
return value, []selects{ret}
|
|
|
|
}
|
2021-05-06 19:54:29 +02:00
|
|
|
func getLabelListValues(list bazel.LabelListAttribute) (reflect.Value, []selects) {
|
2021-04-05 12:35:13 +02:00
|
|
|
value := reflect.ValueOf(list.Value.Includes)
|
2021-05-26 21:08:27 +02:00
|
|
|
var ret []selects
|
2021-05-21 14:37:59 +02:00
|
|
|
for _, axis := range list.SortedConfigurationAxes() {
|
|
|
|
configToLabels := list.ConfigurableValues[axis]
|
|
|
|
if !configToLabels.HasConfigurableValues() {
|
|
|
|
continue
|
2021-05-26 21:08:27 +02:00
|
|
|
}
|
2021-05-21 14:37:59 +02:00
|
|
|
archSelects := map[string]reflect.Value{}
|
bp2build: handle system_shared_libs
- If no system_shared_libs is specified, bp2build writes no attribute
value. In this case, the bazel library macros determine the correct
default behavior.
- If any system_shared_libs is specified for any variant, then bp2build
writes the value verbatim. This includes if an empty list is specified,
as this should override defaulting behavior.
Note this defaulting behavior is incomplete and will be incorrect in
corner cases. For example, if, in an Android.bp, system_shared_libs is
specified for os.linux_bionic but not for os.android, then the bazel
default for os.android will be incorrect. However, there are no current
modules in AOSP which fit this case.
As a related fix, supports static struct for cc_library_static.
Also, removes some elements from the bp2build denylist.
Test: mixed_droid CI
Change-Id: Iee5feeaaf05e8e7209c7a90c913173832ad7bf91
2021-08-04 03:01:05 +02:00
|
|
|
defaultVal := configToLabels[bazel.ConditionsDefaultConfigKey]
|
2021-12-10 00:10:18 +01:00
|
|
|
// Skip empty list values unless ether EmitEmptyList is true, or these values differ from the default.
|
|
|
|
emitEmptyList := list.EmitEmptyList || len(defaultVal.Includes) > 0
|
2021-05-21 14:37:59 +02:00
|
|
|
for config, labels := range configToLabels {
|
bp2build: handle system_shared_libs
- If no system_shared_libs is specified, bp2build writes no attribute
value. In this case, the bazel library macros determine the correct
default behavior.
- If any system_shared_libs is specified for any variant, then bp2build
writes the value verbatim. This includes if an empty list is specified,
as this should override defaulting behavior.
Note this defaulting behavior is incomplete and will be incorrect in
corner cases. For example, if, in an Android.bp, system_shared_libs is
specified for os.linux_bionic but not for os.android, then the bazel
default for os.android will be incorrect. However, there are no current
modules in AOSP which fit this case.
As a related fix, supports static struct for cc_library_static.
Also, removes some elements from the bp2build denylist.
Test: mixed_droid CI
Change-Id: Iee5feeaaf05e8e7209c7a90c913173832ad7bf91
2021-08-04 03:01:05 +02:00
|
|
|
// Omit any entries in the map which match the default value, for brevity.
|
|
|
|
if config != bazel.ConditionsDefaultConfigKey && labels.Equals(defaultVal) {
|
|
|
|
continue
|
|
|
|
}
|
2021-05-21 14:37:59 +02:00
|
|
|
selectKey := axis.SelectKey(config)
|
2021-12-10 00:10:18 +01:00
|
|
|
if use, value := labelListSelectValue(selectKey, labels, emitEmptyList); use {
|
2021-05-21 14:37:59 +02:00
|
|
|
archSelects[selectKey] = value
|
2021-05-26 21:08:27 +02:00
|
|
|
}
|
2021-05-19 12:49:02 +02:00
|
|
|
}
|
2021-05-21 14:37:59 +02:00
|
|
|
if len(archSelects) > 0 {
|
|
|
|
ret = append(ret, archSelects)
|
2021-05-26 21:08:27 +02:00
|
|
|
}
|
|
|
|
}
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
|
2021-05-26 21:08:27 +02:00
|
|
|
return value, ret
|
|
|
|
}
|
|
|
|
|
2021-11-17 13:14:41 +01:00
|
|
|
func labelListSelectValue(selectKey string, list bazel.LabelList, emitEmptyList bool) (bool, reflect.Value) {
|
|
|
|
if selectKey == bazel.ConditionsDefaultSelectKey || emitEmptyList || len(list.Includes) > 0 {
|
2021-05-26 21:08:27 +02:00
|
|
|
return true, reflect.ValueOf(list.Includes)
|
|
|
|
} else if len(list.Excludes) > 0 {
|
|
|
|
// if there is still an excludes -- we need to have an empty list for this select & use the
|
|
|
|
// value in conditions default Includes
|
|
|
|
return true, reflect.ValueOf([]string{})
|
|
|
|
}
|
|
|
|
return false, reflect.Zero(reflect.TypeOf([]string{}))
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
}
|
|
|
|
|
2021-06-03 19:43:01 +02:00
|
|
|
var (
|
|
|
|
emptyBazelList = "[]"
|
|
|
|
bazelNone = "None"
|
|
|
|
)
|
|
|
|
|
2021-04-05 12:35:13 +02:00
|
|
|
// prettyPrintAttribute converts an Attribute to its Bazel syntax. May contain
|
|
|
|
// select statements.
|
|
|
|
func prettyPrintAttribute(v bazel.Attribute, indent int) (string, error) {
|
|
|
|
var value reflect.Value
|
2021-05-06 19:54:29 +02:00
|
|
|
var configurableAttrs []selects
|
2022-12-10 01:08:54 +01:00
|
|
|
var prepend bool
|
2021-06-03 19:43:01 +02:00
|
|
|
var defaultSelectValue *string
|
2021-11-17 13:14:41 +01:00
|
|
|
var emitZeroValues bool
|
bp2build: handle system_shared_libs
- If no system_shared_libs is specified, bp2build writes no attribute
value. In this case, the bazel library macros determine the correct
default behavior.
- If any system_shared_libs is specified for any variant, then bp2build
writes the value verbatim. This includes if an empty list is specified,
as this should override defaulting behavior.
Note this defaulting behavior is incomplete and will be incorrect in
corner cases. For example, if, in an Android.bp, system_shared_libs is
specified for os.linux_bionic but not for os.android, then the bazel
default for os.android will be incorrect. However, there are no current
modules in AOSP which fit this case.
As a related fix, supports static struct for cc_library_static.
Also, removes some elements from the bp2build denylist.
Test: mixed_droid CI
Change-Id: Iee5feeaaf05e8e7209c7a90c913173832ad7bf91
2021-08-04 03:01:05 +02:00
|
|
|
// If true, print the default attribute value, even if the attribute is zero.
|
|
|
|
shouldPrintDefault := false
|
2021-04-05 12:35:13 +02:00
|
|
|
switch list := v.(type) {
|
2022-06-23 18:02:44 +02:00
|
|
|
case bazel.StringAttribute:
|
|
|
|
if err := list.Collapse(); err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
value, configurableAttrs = getStringValue(list)
|
|
|
|
defaultSelectValue = &bazelNone
|
2021-04-05 12:35:13 +02:00
|
|
|
case bazel.StringListAttribute:
|
2022-12-10 01:08:54 +01:00
|
|
|
value, configurableAttrs, prepend = getStringListValues(list)
|
2021-06-03 19:43:01 +02:00
|
|
|
defaultSelectValue = &emptyBazelList
|
2021-04-05 12:35:13 +02:00
|
|
|
case bazel.LabelListAttribute:
|
2021-05-06 19:54:29 +02:00
|
|
|
value, configurableAttrs = getLabelListValues(list)
|
2021-11-17 13:14:41 +01:00
|
|
|
emitZeroValues = list.EmitEmptyList
|
2021-06-03 19:43:01 +02:00
|
|
|
defaultSelectValue = &emptyBazelList
|
bp2build: handle system_shared_libs
- If no system_shared_libs is specified, bp2build writes no attribute
value. In this case, the bazel library macros determine the correct
default behavior.
- If any system_shared_libs is specified for any variant, then bp2build
writes the value verbatim. This includes if an empty list is specified,
as this should override defaulting behavior.
Note this defaulting behavior is incomplete and will be incorrect in
corner cases. For example, if, in an Android.bp, system_shared_libs is
specified for os.linux_bionic but not for os.android, then the bazel
default for os.android will be incorrect. However, there are no current
modules in AOSP which fit this case.
As a related fix, supports static struct for cc_library_static.
Also, removes some elements from the bp2build denylist.
Test: mixed_droid CI
Change-Id: Iee5feeaaf05e8e7209c7a90c913173832ad7bf91
2021-08-04 03:01:05 +02:00
|
|
|
if list.ForceSpecifyEmptyList && (!value.IsNil() || list.HasConfigurableValues()) {
|
|
|
|
shouldPrintDefault = true
|
|
|
|
}
|
2021-04-30 15:35:09 +02:00
|
|
|
case bazel.LabelAttribute:
|
2021-12-10 00:10:18 +01:00
|
|
|
if err := list.Collapse(); err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
2021-05-06 19:54:29 +02:00
|
|
|
value, configurableAttrs = getLabelValue(list)
|
2021-06-03 19:43:01 +02:00
|
|
|
defaultSelectValue = &bazelNone
|
|
|
|
case bazel.BoolAttribute:
|
2021-12-10 00:10:18 +01:00
|
|
|
if err := list.Collapse(); err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
2021-06-03 19:43:01 +02:00
|
|
|
value, configurableAttrs = getBoolValue(list)
|
|
|
|
defaultSelectValue = &bazelNone
|
2021-04-05 12:35:13 +02:00
|
|
|
default:
|
|
|
|
return "", fmt.Errorf("Not a supported Bazel attribute type: %s", v)
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
}
|
|
|
|
|
2021-05-06 19:54:29 +02:00
|
|
|
var err error
|
2021-05-05 09:00:01 +02:00
|
|
|
ret := ""
|
|
|
|
if value.Kind() != reflect.Invalid {
|
2021-11-17 13:14:41 +01:00
|
|
|
s, err := prettyPrint(value, indent, false) // never emit zero values for the base value
|
2021-05-05 09:00:01 +02:00
|
|
|
if err != nil {
|
|
|
|
return ret, err
|
|
|
|
}
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
|
2021-05-05 09:00:01 +02:00
|
|
|
ret += s
|
|
|
|
}
|
2022-12-10 01:08:54 +01:00
|
|
|
// Convenience function to prepend/append selects components to an attribute value.
|
|
|
|
concatenateSelects := func(selectsData selects, defaultValue *string, s string, prepend bool) (string, error) {
|
2021-11-17 13:14:41 +01:00
|
|
|
selectMap, err := prettyPrintSelectMap(selectsData, defaultValue, indent, emitZeroValues)
|
2021-03-24 15:04:33 +01:00
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
2022-12-10 01:08:54 +01:00
|
|
|
var left, right string
|
|
|
|
if prepend {
|
|
|
|
left, right = selectMap, s
|
|
|
|
} else {
|
|
|
|
left, right = s, selectMap
|
|
|
|
}
|
|
|
|
if left != "" && right != "" {
|
|
|
|
left += " + "
|
2021-03-24 15:04:33 +01:00
|
|
|
}
|
2022-12-10 01:08:54 +01:00
|
|
|
left += right
|
2021-03-24 15:04:33 +01:00
|
|
|
|
2022-12-10 01:08:54 +01:00
|
|
|
return left, nil
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
}
|
|
|
|
|
2021-05-06 19:54:29 +02:00
|
|
|
for _, configurableAttr := range configurableAttrs {
|
2022-12-10 01:08:54 +01:00
|
|
|
ret, err = concatenateSelects(configurableAttr, defaultSelectValue, ret, prepend)
|
2021-05-06 19:54:29 +02:00
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
2021-04-05 12:35:13 +02:00
|
|
|
}
|
|
|
|
|
bp2build: handle system_shared_libs
- If no system_shared_libs is specified, bp2build writes no attribute
value. In this case, the bazel library macros determine the correct
default behavior.
- If any system_shared_libs is specified for any variant, then bp2build
writes the value verbatim. This includes if an empty list is specified,
as this should override defaulting behavior.
Note this defaulting behavior is incomplete and will be incorrect in
corner cases. For example, if, in an Android.bp, system_shared_libs is
specified for os.linux_bionic but not for os.android, then the bazel
default for os.android will be incorrect. However, there are no current
modules in AOSP which fit this case.
As a related fix, supports static struct for cc_library_static.
Also, removes some elements from the bp2build denylist.
Test: mixed_droid CI
Change-Id: Iee5feeaaf05e8e7209c7a90c913173832ad7bf91
2021-08-04 03:01:05 +02:00
|
|
|
if ret == "" && shouldPrintDefault {
|
|
|
|
return *defaultSelectValue, nil
|
|
|
|
}
|
2021-05-06 19:54:29 +02:00
|
|
|
return ret, nil
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// prettyPrintSelectMap converts a map of select keys to reflected Values as a generic way
|
|
|
|
// to construct a select map for any kind of attribute type.
|
2021-11-17 13:14:41 +01:00
|
|
|
func prettyPrintSelectMap(selectMap map[string]reflect.Value, defaultValue *string, indent int, emitZeroValues bool) (string, error) {
|
2021-04-05 12:35:13 +02:00
|
|
|
if selectMap == nil {
|
|
|
|
return "", nil
|
|
|
|
}
|
|
|
|
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
var selects string
|
|
|
|
for _, selectKey := range android.SortedStringKeys(selectMap) {
|
2021-05-06 19:54:29 +02:00
|
|
|
if selectKey == bazel.ConditionsDefaultSelectKey {
|
2021-04-23 11:17:24 +02:00
|
|
|
// Handle default condition later.
|
|
|
|
continue
|
|
|
|
}
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
value := selectMap[selectKey]
|
2021-12-10 00:10:18 +01:00
|
|
|
if isZero(value) && !emitZeroValues && isZero(selectMap[bazel.ConditionsDefaultSelectKey]) {
|
|
|
|
// Ignore zero values to not generate empty lists. However, always note zero values if
|
|
|
|
// the default value is non-zero.
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
continue
|
|
|
|
}
|
2021-12-10 00:10:18 +01:00
|
|
|
s, err := prettyPrintSelectEntry(value, selectKey, indent, true)
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
2021-04-13 09:14:55 +02:00
|
|
|
// s could still be an empty string, e.g. unset slices of structs with
|
|
|
|
// length of 0.
|
|
|
|
if s != "" {
|
|
|
|
selects += s + ",\n"
|
|
|
|
}
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if len(selects) == 0 {
|
|
|
|
// No conditions (or all values are empty lists), so no need for a map.
|
|
|
|
return "", nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create the map.
|
2021-03-24 15:04:33 +01:00
|
|
|
ret := "select({\n"
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
ret += selects
|
2021-04-23 11:17:24 +02:00
|
|
|
|
|
|
|
// Handle the default condition
|
2021-11-17 13:14:41 +01:00
|
|
|
s, err := prettyPrintSelectEntry(selectMap[bazel.ConditionsDefaultSelectKey], bazel.ConditionsDefaultSelectKey, indent, emitZeroValues)
|
2021-04-23 11:17:24 +02:00
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
2021-06-03 19:43:01 +02:00
|
|
|
if s != "" {
|
2021-04-23 11:17:24 +02:00
|
|
|
// Print the custom default value.
|
|
|
|
ret += s
|
|
|
|
ret += ",\n"
|
2021-06-03 19:43:01 +02:00
|
|
|
} else if defaultValue != nil {
|
|
|
|
// Print an explicit empty list (the default value) even if the value is
|
|
|
|
// empty, to avoid errors about not finding a configuration that matches.
|
2022-02-03 14:42:10 +01:00
|
|
|
ret += fmt.Sprintf("%s\"%s\": %s,\n", starlark_fmt.Indention(indent+1), bazel.ConditionsDefaultSelectKey, *defaultValue)
|
2021-04-23 11:17:24 +02:00
|
|
|
}
|
|
|
|
|
2022-02-03 14:42:10 +01:00
|
|
|
ret += starlark_fmt.Indention(indent)
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
ret += "})"
|
|
|
|
|
|
|
|
return ret, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// prettyPrintSelectEntry converts a reflect.Value into an entry in a select map
|
|
|
|
// with a provided key.
|
2021-11-17 13:14:41 +01:00
|
|
|
func prettyPrintSelectEntry(value reflect.Value, key string, indent int, emitZeroValues bool) (string, error) {
|
2022-02-03 14:42:10 +01:00
|
|
|
s := starlark_fmt.Indention(indent + 1)
|
2021-11-17 13:14:41 +01:00
|
|
|
v, err := prettyPrint(value, indent+1, emitZeroValues)
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
2021-04-13 09:14:55 +02:00
|
|
|
if v == "" {
|
|
|
|
return "", nil
|
|
|
|
}
|
Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-03-24 07:18:33 +01:00
|
|
|
s += fmt.Sprintf("\"%s\": %s", key, v)
|
|
|
|
return s, nil
|
|
|
|
}
|