Add default_shared_libs property

Building against a locally-built libc besides bionic requires setting
system_shared_libs to avoid circular dependencies, but modules all
over the tree assume that system_shared_libs only affects modules
building against bionic.  Add a new default_shared_libs property
that applies to all modules, which will generally be set in
arch-specific clauses to only affect the desired set of modules.

Bug: 190084016
Test: m checkbuild
Change-Id: Ia2349d84c70e503916f90a5d2702e135248f73df
This commit is contained in:
Colin Cross
2021-06-22 13:20:01 -07:00
parent d1a2813063
commit 9ecb42dd31
5 changed files with 219 additions and 23 deletions

View File

@@ -258,6 +258,12 @@ func addPossiblyArchSpecificProperties(sdkModuleContext android.ModuleContext, b
outputProperties.AddPropertyWithTag("system_shared_libs", libInfo.SystemSharedLibs, builder.SdkMemberReferencePropertyTag(false))
}
// SystemSharedLibs needs to be propagated if it's a list, even if it's empty,
// so check for non-nil instead of nonzero length.
if libInfo.DefaultSharedLibs != nil {
outputProperties.AddPropertyWithTag("default_shared_libs", libInfo.DefaultSharedLibs, builder.SdkMemberReferencePropertyTag(false))
}
// Map from property name to the include dirs to add to the prebuilt module in the snapshot.
includeDirs := make(map[string][]string)
@@ -387,6 +393,12 @@ type nativeLibInfoProperties struct {
// This field is exported as its contents may not be arch specific.
SystemSharedLibs []string `android:"arch_variant"`
// The set of default shared libraries. Note nil and [] are semantically
// distinct - see BaseLinkerProperties.Default_shared_libs.
//
// This field is exported as its contents may not be arch specific.
DefaultSharedLibs []string `android:"arch_variant"`
// The specific stubs version for the lib variant, or empty string if stubs
// are not in use.
//
@@ -462,6 +474,7 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte
}
}
p.SystemSharedLibs = specifiedDeps.systemSharedLibs
p.DefaultSharedLibs = specifiedDeps.defaultSharedLibs
}
p.ExportedGeneratedHeaders = exportedInfo.GeneratedHeaders