Implement stubs.symbol_file and stubs.versions for cc_library_shared bp2build.

This CL turns the stubs.symbol_file and stubs.versions properties into
stubs_symbol_file and stubs_version attributes on the cc_shared_library
target. See associated build/bazel change on how these attributes are
used to generate stub libraries.

Bug: 207812332

Test: New tests
Test: CI
Change-Id: Ie23eafb9903a131d92ff4e251215e998cea0a763
This commit is contained in:
Jingwen Chen
2022-01-07 14:55:29 +00:00
parent 2a1291d01d
commit 0ee88a6b65
8 changed files with 102 additions and 3 deletions

View File

@@ -280,6 +280,9 @@ type compilerAttributes struct {
includes BazelIncludes
protoSrcs bazel.LabelListAttribute
stubsSymbolFile *string
stubsVersions bazel.StringListAttribute
}
type filterOutFn func(string) bool
@@ -464,10 +467,11 @@ func includesFromLabelList(labelList bazel.LabelList) (relative, absolute []stri
return relative, absolute
}
// bp2BuildParseCompilerProps returns copts, srcs and hdrs and other attributes.
// bp2BuildParseBaseProps returns all compiler, linker, library attributes of a cc module..
func bp2BuildParseBaseProps(ctx android.Bp2buildMutatorContext, module *Module) baseAttributes {
archVariantCompilerProps := module.GetArchVariantProperties(ctx, &BaseCompilerProperties{})
archVariantLinkerProps := module.GetArchVariantProperties(ctx, &BaseLinkerProperties{})
archVariantLibraryProperties := module.GetArchVariantProperties(ctx, &LibraryProperties{})
var implementationHdrs bazel.LabelListAttribute
@@ -484,6 +488,7 @@ func bp2BuildParseBaseProps(ctx android.Bp2buildMutatorContext, module *Module)
}
allAxesAndConfigs(archVariantCompilerProps)
allAxesAndConfigs(archVariantLinkerProps)
allAxesAndConfigs(archVariantLibraryProperties)
compilerAttrs := compilerAttributes{}
linkerAttrs := linkerAttributes{}
@@ -519,6 +524,13 @@ func bp2BuildParseBaseProps(ctx android.Bp2buildMutatorContext, module *Module)
currIncludes := compilerAttrs.localIncludes.SelectValue(axis, config)
currIncludes = android.FirstUniqueStrings(append(currIncludes, includes...))
compilerAttrs.localIncludes.SetSelectValue(axis, config, currIncludes)
if libraryProps, ok := archVariantLibraryProperties[axis][config].(*LibraryProperties); ok {
if axis == bazel.NoConfigAxis {
compilerAttrs.stubsSymbolFile = libraryProps.Stubs.Symbol_file
compilerAttrs.stubsVersions.SetSelectValue(axis, config, libraryProps.Stubs.Versions)
}
}
}
}