Parameterize cc_stub_suite for api surface
cc_stub_suite now has an additional attribute correponding to the api
surface. This attribute will be used to pass additional args to the stub
generator.
Update bp2build to set the api_surface of the apex stubs. This ensures
that its stubs are generated with "--systemapi --apex"
Test: unit tests
Bug: 298085502
Change-Id: If4c479f85e6e485b5c795a565a0c559f1f013bf5
diff --git a/bp2build/apex_conversion_test.go b/bp2build/apex_conversion_test.go
index 5aed4ad..d6db677 100644
--- a/bp2build/apex_conversion_test.go
+++ b/bp2build/apex_conversion_test.go
@@ -1315,6 +1315,7 @@
"tags": `["apex_available=myapex"]`,
}),
MakeBazelTarget("cc_stub_suite", "foo_stub_libs", AttrNameToString{
+ "api_surface": `"module-libapi"`,
"soname": `"foo.so"`,
"source_library_label": `"//:foo"`,
"symbol_file": `"foo.map.txt"`,
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 7af788e..b667fe9 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -2809,6 +2809,7 @@
"stubs_symbol_file": `"a.map.txt"`,
})
expectedBazelTargets = append(expectedBazelTargets, makeCcStubSuiteTargets("a", AttrNameToString{
+ "api_surface": `"module-libapi"`,
"soname": `"a.so"`,
"source_library_label": `"//foo/bar:a"`,
"stubs_symbol_file": `"a.map.txt"`,
diff --git a/bp2build/cc_library_shared_conversion_test.go b/bp2build/cc_library_shared_conversion_test.go
index 44b9722..d470810 100644
--- a/bp2build/cc_library_shared_conversion_test.go
+++ b/bp2build/cc_library_shared_conversion_test.go
@@ -543,6 +543,7 @@
},
Blueprint: soongCcLibraryPreamble,
ExpectedBazelTargets: []string{makeCcStubSuiteTargets("a", AttrNameToString{
+ "api_surface": `"module-libapi"`,
"soname": `"a.so"`,
"source_library_label": `"//foo/bar:a"`,
"stubs_symbol_file": `"a.map.txt"`,
@@ -1442,6 +1443,7 @@
`,
ExpectedBazelTargets: []string{
makeCcStubSuiteTargets("a", AttrNameToString{
+ "api_surface": `"module-libapi"`,
"soname": `"a.so"`,
"source_library_label": `"//:a"`,
"stubs_symbol_file": `"a.map.txt"`,
@@ -1456,6 +1458,7 @@
"stubs_symbol_file": `"a.map.txt"`,
}),
makeCcStubSuiteTargets("b", AttrNameToString{
+ "api_surface": `"module-libapi"`,
"soname": `"b.so"`,
"source_library_label": `"//:b"`,
"stubs_symbol_file": `"b.map.txt"`,
diff --git a/bp2build/testing.go b/bp2build/testing.go
index 0e7ef44..2924e9a 100644
--- a/bp2build/testing.go
+++ b/bp2build/testing.go
@@ -644,6 +644,7 @@
return ""
}
STUB_SUITE_ATTRS := map[string]string{
+ "api_surface": "api_surface",
"stubs_symbol_file": "symbol_file",
"stubs_versions": "versions",
"soname": "soname",