Only generate stubs for shared libraries

Bug: 246958825
Test: Unit tests
Test: m nothing
Change-Id: If976027314b079525397fa8f5d6dc3de9f1221c8
This commit is contained in:
Trevor Radcliffe
2022-09-20 23:04:39 +00:00
parent 9f6e6238ef
commit f19d8a7f0a
2 changed files with 10 additions and 12 deletions

View File

@@ -488,22 +488,21 @@ cc_library_shared {
`, `,
}, },
Blueprint: soongCcLibraryPreamble, Blueprint: soongCcLibraryPreamble,
ExpectedBazelTargets: []string{MakeBazelTarget("cc_library_shared", "a", AttrNameToString{ ExpectedBazelTargets: []string{makeCcStubSuiteTargets("a", AttrNameToString{
"has_stubs": `True`, "soname": `"a.so"`,
}), "source_library": `":a"`,
makeCcStubSuiteTargets("a", AttrNameToString{ "stubs_symbol_file": `"a.map.txt"`,
"soname": `"a.so"`, "stubs_versions": `[
"source_library": `":a"`,
"stubs_symbol_file": `"a.map.txt"`,
"stubs_versions": `[
"28", "28",
"29", "29",
"current", "current",
]`, ]`,
}),
MakeBazelTarget("cc_library_shared", "a", AttrNameToString{
"has_stubs": `True`,
}), }),
}, },
}, })
)
} }
func TestCcLibrarySharedSystemSharedLibsSharedEmpty(t *testing.T) { func TestCcLibrarySharedSystemSharedLibsSharedEmpty(t *testing.T) {

View File

@@ -2704,6 +2704,7 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo
modType = "cc_library_static" modType = "cc_library_static"
} else { } else {
modType = "cc_library_shared" modType = "cc_library_shared"
createStubsBazelTargetIfNeeded(ctx, module, compilerAttrs, exportedIncludes, baseAttributes)
} }
props := bazel.BazelTargetModuleProperties{ props := bazel.BazelTargetModuleProperties{
Rule_class: modType, Rule_class: modType,
@@ -2711,8 +2712,6 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo
} }
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, attrs) 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? // TODO(b/199902614): Can this be factored to share with the other Attributes?