Implement configured version_script.
Bug: 186650430 Test: Presubmits. Change-Id: I3e363ea9254a859dc8f485c9f273f6b3677f7645
This commit is contained in:
parent
b9ebb7dfd8
commit
56bb083989
2 changed files with 50 additions and 2 deletions
|
@ -350,6 +350,43 @@ cc_library {
|
|||
copts = ["-Ifoo/bar"],
|
||||
srcs = ["a.cpp"],
|
||||
version_script = "v.map",
|
||||
)`},
|
||||
},
|
||||
{
|
||||
description: "cc_library configured version script",
|
||||
moduleTypeUnderTest: "cc_library",
|
||||
moduleTypeUnderTestFactory: cc.LibraryFactory,
|
||||
moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryBp2Build,
|
||||
depsMutators: []android.RegisterMutatorFunc{cc.RegisterDepsBp2Build},
|
||||
dir: "foo/bar",
|
||||
filesystem: map[string]string{
|
||||
"foo/bar/Android.bp": `
|
||||
cc_library {
|
||||
name: "a",
|
||||
srcs: ["a.cpp"],
|
||||
arch: {
|
||||
arm: {
|
||||
version_script: "arm.map",
|
||||
},
|
||||
arm64: {
|
||||
version_script: "arm64.map",
|
||||
},
|
||||
},
|
||||
|
||||
bazel_module: { bp2build_available: true },
|
||||
}
|
||||
`,
|
||||
},
|
||||
bp: soongCcLibraryPreamble,
|
||||
expectedBazelTargets: []string{`cc_library(
|
||||
name = "a",
|
||||
copts = ["-Ifoo/bar"],
|
||||
srcs = ["a.cpp"],
|
||||
version_script = select({
|
||||
"//build/bazel/platforms/arch:arm": "arm.map",
|
||||
"//build/bazel/platforms/arch:arm64": "arm64.map",
|
||||
"//conditions:default": None,
|
||||
}),
|
||||
)`},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -31,8 +31,19 @@ func getStringListValues(list bazel.StringListAttribute) (reflect.Value, selects
|
|||
}
|
||||
|
||||
func getLabelValue(label bazel.LabelAttribute) (reflect.Value, selects, selects) {
|
||||
value := reflect.ValueOf(label.Value)
|
||||
return value, nil, nil
|
||||
var value reflect.Value
|
||||
var archSelects selects
|
||||
|
||||
if label.HasConfigurableValues() {
|
||||
archSelects = map[string]reflect.Value{}
|
||||
for arch, selectKey := range bazel.PlatformArchMap {
|
||||
archSelects[selectKey] = reflect.ValueOf(label.GetValueForArch(arch))
|
||||
}
|
||||
} else {
|
||||
value = reflect.ValueOf(label.Value)
|
||||
}
|
||||
|
||||
return value, archSelects, nil
|
||||
}
|
||||
|
||||
func getLabelListValues(list bazel.LabelListAttribute) (reflect.Value, selects, selects) {
|
||||
|
|
Loading…
Reference in a new issue