Clean up mixed builds module names filtering

* Remove `Bp2buildCcLibraryStaticOnlyList` it is never set
* Remove the rest of the sutff related to it
* Streamline MixedBuildsEnabled
* Rename BazelContext.BazelAllowlisted to BazelContext.NameFilter
  to reflect its action
* Rename bazelContext to mixedBuildBazelContext
* Fix minor warnings from Go static analyzer

Test: treehugger
Change-Id: Ie245c992f94bbfd5c7c23dd06917026200a28263
This commit is contained in:
Sasha Smundak
2022-12-29 17:11:49 -08:00
committed by Alexander Smundak
parent bf51151bd4
commit 39a301c963
7 changed files with 71 additions and 130 deletions

View File

@@ -292,14 +292,6 @@ func stripAttrsFromLinkerAttrs(la *linkerAttributes) stripAttributes {
}
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
// the cc_library_static bp2build converter temporarily instead.
if android.GetBp2BuildAllowList().GenerateCcLibraryStaticOnly(ctx.Module().Name()) {
sharedOrStaticLibraryBp2Build(ctx, m, true)
return
}
sharedAttrs := bp2BuildParseSharedProps(ctx, m)
staticAttrs := bp2BuildParseStaticProps(ctx, m)
baseAttributes := bp2BuildParseBaseProps(ctx, m)
@@ -413,12 +405,12 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) {
sharedTargetAttrs.Suffix = compilerAttrs.suffix
for axis, configToProps := range m.GetArchVariantProperties(ctx, &LibraryProperties{}) {
for config, props := range configToProps {
for cfg, props := range configToProps {
if props, ok := props.(*LibraryProperties); ok {
if props.Inject_bssl_hash != nil {
// This is an edge case applies only to libcrypto
if m.Name() == "libcrypto" || m.Name() == "libcrypto_for_testing" {
sharedTargetAttrs.Inject_bssl_hash.SetSelectValue(axis, config, props.Inject_bssl_hash)
sharedTargetAttrs.Inject_bssl_hash.SetSelectValue(axis, cfg, props.Inject_bssl_hash)
} else {
ctx.PropertyErrorf("inject_bssl_hash", "only applies to libcrypto")
}
@@ -1034,7 +1026,7 @@ func GlobHeadersForSnapshot(ctx android.ModuleContext, paths android.Paths) andr
return ret
}
func GlobGeneratedHeadersForSnapshot(ctx android.ModuleContext, paths android.Paths) android.Paths {
func GlobGeneratedHeadersForSnapshot(_ android.ModuleContext, paths android.Paths) android.Paths {
ret := android.Paths{}
for _, header := range paths {
// TODO(b/148123511): remove exportedDeps after cleaning up genrule
@@ -1900,7 +1892,7 @@ func (library *libraryDecorator) crossVersionAbiDiff(ctx android.ModuleContext,
errorMessage := "error: Please follow https://android.googlesource.com/platform/development/+/master/vndk/tools/header-checker/README.md#configure-cross_version-abi-check to resolve the ABI difference between your source code and version " + prevVersion + "."
library.sourceAbiDiff(ctx, referenceDump, baseName, prevVersion,
isLlndkOrNdk, /* allowExtensions */ true, sourceVersion, errorMessage)
isLlndkOrNdk, true /* allowExtensions */, sourceVersion, errorMessage)
}
func (library *libraryDecorator) sameVersionAbiDiff(ctx android.ModuleContext, referenceDump android.Path,
@@ -1909,7 +1901,7 @@ func (library *libraryDecorator) sameVersionAbiDiff(ctx android.ModuleContext, r
libName := strings.TrimSuffix(baseName, filepath.Ext(baseName))
errorMessage := "error: Please update ABI references with: $$ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l " + libName
library.sourceAbiDiff(ctx, referenceDump, baseName, /* nameExt */ "",
library.sourceAbiDiff(ctx, referenceDump, baseName, "",
isLlndkOrNdk, allowExtensions, "current", errorMessage)
}
@@ -1920,7 +1912,7 @@ func (library *libraryDecorator) optInAbiDiff(ctx android.ModuleContext, referen
errorMessage := "error: Please update ABI references with: $$ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l " + libName + " -ref-dump-dir $$ANDROID_BUILD_TOP/" + refDumpDir
library.sourceAbiDiff(ctx, referenceDump, baseName, nameExt,
isLlndkOrNdk, /* allowExtensions */ false, "current", errorMessage)
isLlndkOrNdk, false /* allowExtensions */, "current", errorMessage)
}
func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objects, fileName string, soFile android.Path) {