Implement stubs.symbol_file and stubs.versions for cc_library_shared bp2build.

This CL turns the stubs.symbol_file and stubs.versions properties into
stubs_symbol_file and stubs_version attributes on the cc_shared_library
target. See associated build/bazel change on how these attributes are
used to generate stub libraries.

Bug: 207812332

Test: New tests
Test: CI
Change-Id: Ie23eafb9903a131d92ff4e251215e998cea0a763
This commit is contained in:
Jingwen Chen
2022-01-07 14:55:29 +00:00
parent 2a1291d01d
commit 0ee88a6b65
8 changed files with 102 additions and 3 deletions

View File

@@ -1297,6 +1297,8 @@ func makeCcLibraryTargets(name string, attrs attrNameToString) []string {
"additional_linker_inputs": true,
"linkopts": true,
"strip": true,
"stubs_symbol_file": true,
"stubs_versions": true,
}
sharedAttrs := attrNameToString{}
staticAttrs := attrNameToString{}
@@ -2390,3 +2392,32 @@ func TestCcLibraryStaticDisabledForSomeArch(t *testing.T) {
}),
}})
}
func TestCcLibraryStubs(t *testing.T) {
runCcLibraryTestCase(t, bp2buildTestCase{
description: "cc_library stubs",
moduleTypeUnderTest: "cc_library",
moduleTypeUnderTestFactory: cc.LibraryFactory,
dir: "foo/bar",
filesystem: map[string]string{
"foo/bar/Android.bp": `
cc_library {
name: "a",
stubs: { symbol_file: "a.map.txt", versions: ["28", "29", "current"] },
bazel_module: { bp2build_available: true },
include_build_directory: false,
}
`,
},
blueprint: soongCcLibraryPreamble,
expectedBazelTargets: makeCcLibraryTargets("a", attrNameToString{
"stubs_symbol_file": `"a.map.txt"`,
"stubs_versions": `[
"28",
"29",
"current",
]`,
}),
},
)
}