diff options
author | 2023-09-13 23:59:05 +0000 | |
---|---|---|
committer | 2023-09-14 17:07:24 +0000 | |
commit | 04f9f4cf71074b26e6da03b3d3106e07942626cf (patch) | |
tree | 3ac4136e5bff5da79f6b97fbb33a889a2513245a | |
parent | b46969dd3d039fdfde43e60f84d2346cc63c8687 (diff) |
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
-rw-r--r-- | bp2build/apex_conversion_test.go | 1 | ||||
-rw-r--r-- | bp2build/cc_library_conversion_test.go | 1 | ||||
-rw-r--r-- | bp2build/cc_library_shared_conversion_test.go | 3 | ||||
-rw-r--r-- | bp2build/testing.go | 1 | ||||
-rw-r--r-- | cc/library.go | 2 |
5 files changed, 8 insertions, 0 deletions
diff --git a/bp2build/apex_conversion_test.go b/bp2build/apex_conversion_test.go index 5aed4ad66..d6db6778a 100644 --- a/bp2build/apex_conversion_test.go +++ b/bp2build/apex_conversion_test.go @@ -1315,6 +1315,7 @@ apex { "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 7af788eba..b667fe9dc 100644 --- a/bp2build/cc_library_conversion_test.go +++ b/bp2build/cc_library_conversion_test.go @@ -2809,6 +2809,7 @@ func TestCcLibraryStubs(t *testing.T) { "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 44b97227e..d470810fb 100644 --- a/bp2build/cc_library_shared_conversion_test.go +++ b/bp2build/cc_library_shared_conversion_test.go @@ -543,6 +543,7 @@ cc_library_shared { }, 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 @@ cc_library_shared { `, 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 @@ cc_library_shared { "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 0e7ef4463..2924e9ae6 100644 --- a/bp2build/testing.go +++ b/bp2build/testing.go @@ -644,6 +644,7 @@ func makeCcStubSuiteTargets(name string, attrs AttrNameToString) string { return "" } STUB_SUITE_ATTRS := map[string]string{ + "api_surface": "api_surface", "stubs_symbol_file": "symbol_file", "stubs_versions": "versions", "soname": "soname", diff --git a/cc/library.go b/cc/library.go index 2d4d60440..7e0c55ac2 100644 --- a/cc/library.go +++ b/cc/library.go @@ -494,6 +494,7 @@ func createStubsBazelTargetIfNeeded(ctx android.TopDownMutatorContext, m *Module Soname: &soname, Source_library_label: proptools.StringPtr(m.GetBazelLabel(ctx, m)), Deps: baseAttributes.deps, + Api_surface: proptools.StringPtr("module-libapi"), } ctx.CreateBazelTargetModule(stubSuitesProps, android.CommonAttributes{Name: m.Name() + "_stub_libs"}, @@ -3121,6 +3122,7 @@ type bazelCcStubSuiteAttributes struct { Source_library_label *string Soname *string Deps bazel.LabelListAttribute + Api_surface *string } type bazelCcHeaderAbiCheckerAttributes struct { |