Support cc_prebuilt_binary building with Bazel

Bp2build-enable cc_prebuilt_binary -> cc_prebuilt_binary

Bug: 241415823
Test: cc_prebuilt_binary_conversion_test.go
Change-Id: I007deef8d44f68993012f2114314d1cb52cfbb0e
This commit is contained in:
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
2022-09-01 15:04:04 +00:00
parent a44a4e079f
commit b12ff59f0b
6 changed files with 208 additions and 47 deletions

View File

@@ -288,6 +288,16 @@ type stripAttributes struct {
None bazel.BoolAttribute
}
func stripAttrsFromLinkerAttrs(la *linkerAttributes) stripAttributes {
return stripAttributes{
Keep_symbols: la.stripKeepSymbols,
Keep_symbols_and_debug_frame: la.stripKeepSymbolsAndDebugFrame,
Keep_symbols_list: la.stripKeepSymbolsList,
All: la.stripAll,
None: la.stripNone,
}
}
func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) {
// For some cc_library modules, their static variants are ready to be
// converted, but not their shared variants. For these modules, delegate to
@@ -394,13 +404,7 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) {
Additional_linker_inputs: linkerAttrs.additionalLinkerInputs,
Strip: stripAttributes{
Keep_symbols: linkerAttrs.stripKeepSymbols,
Keep_symbols_and_debug_frame: linkerAttrs.stripKeepSymbolsAndDebugFrame,
Keep_symbols_list: linkerAttrs.stripKeepSymbolsList,
All: linkerAttrs.stripAll,
None: linkerAttrs.stripNone,
},
Strip: stripAttrsFromLinkerAttrs(&linkerAttrs),
Features: baseAttributes.features,
}
@@ -2697,13 +2701,7 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo
Absolute_includes: compilerAttrs.absoluteIncludes,
Additional_linker_inputs: linkerAttrs.additionalLinkerInputs,
Strip: stripAttributes{
Keep_symbols: linkerAttrs.stripKeepSymbols,
Keep_symbols_and_debug_frame: linkerAttrs.stripKeepSymbolsAndDebugFrame,
Keep_symbols_list: linkerAttrs.stripKeepSymbolsList,
All: linkerAttrs.stripAll,
None: linkerAttrs.stripNone,
},
Strip: stripAttrsFromLinkerAttrs(&linkerAttrs),
Features: baseAttributes.features,