diff options
| author | 2022-09-20 23:04:39 +0000 | |
|---|---|---|
| committer | 2022-09-20 23:04:39 +0000 | |
| commit | f19d8a7f0aaa900140f95fdaae3e31e1232cf66f (patch) | |
| tree | 0eeb7de2c70c949d769d933bb6ba4f74c3bb5c05 | |
| parent | 9f6e6238ef3c6fa975a60f7b115b6b266c71461c (diff) | |
Only generate stubs for shared libraries
Bug: 246958825
Test: Unit tests
Test: m nothing
Change-Id: If976027314b079525397fa8f5d6dc3de9f1221c8
| -rw-r--r-- | bp2build/cc_library_shared_conversion_test.go | 19 | ||||
| -rw-r--r-- | cc/library.go | 3 |
2 files changed, 10 insertions, 12 deletions
diff --git a/bp2build/cc_library_shared_conversion_test.go b/bp2build/cc_library_shared_conversion_test.go index 48515c852..1bc3ec03f 100644 --- a/bp2build/cc_library_shared_conversion_test.go +++ b/bp2build/cc_library_shared_conversion_test.go @@ -488,22 +488,21 @@ cc_library_shared { `, }, Blueprint: soongCcLibraryPreamble, - ExpectedBazelTargets: []string{MakeBazelTarget("cc_library_shared", "a", AttrNameToString{ - "has_stubs": `True`, - }), - makeCcStubSuiteTargets("a", AttrNameToString{ - "soname": `"a.so"`, - "source_library": `":a"`, - "stubs_symbol_file": `"a.map.txt"`, - "stubs_versions": `[ + ExpectedBazelTargets: []string{makeCcStubSuiteTargets("a", AttrNameToString{ + "soname": `"a.so"`, + "source_library": `":a"`, + "stubs_symbol_file": `"a.map.txt"`, + "stubs_versions": `[ "28", "29", "current", ]`, + }), + MakeBazelTarget("cc_library_shared", "a", AttrNameToString{ + "has_stubs": `True`, }), }, - }, - ) + }) } func TestCcLibrarySharedSystemSharedLibsSharedEmpty(t *testing.T) { diff --git a/cc/library.go b/cc/library.go index 83a2c6875..56534a6b4 100644 --- a/cc/library.go +++ b/cc/library.go @@ -2704,6 +2704,7 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo modType = "cc_library_static" } else { modType = "cc_library_shared" + createStubsBazelTargetIfNeeded(ctx, module, compilerAttrs, exportedIncludes, baseAttributes) } props := bazel.BazelTargetModuleProperties{ Rule_class: modType, @@ -2711,8 +2712,6 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo } ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, attrs) - - createStubsBazelTargetIfNeeded(ctx, module, compilerAttrs, exportedIncludes, baseAttributes) } // TODO(b/199902614): Can this be factored to share with the other Attributes? |