Merge "Attach global variables to Context"
This commit is contained in:
@@ -86,7 +86,7 @@ func (c *Module) AndroidMk() android.AndroidMkData {
|
|||||||
if len(c.Properties.AndroidMkWholeStaticLibs) > 0 {
|
if len(c.Properties.AndroidMkWholeStaticLibs) > 0 {
|
||||||
fmt.Fprintln(w, "LOCAL_WHOLE_STATIC_LIBRARIES := "+strings.Join(c.Properties.AndroidMkWholeStaticLibs, " "))
|
fmt.Fprintln(w, "LOCAL_WHOLE_STATIC_LIBRARIES := "+strings.Join(c.Properties.AndroidMkWholeStaticLibs, " "))
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_LINK_TYPE :=", c.getMakeLinkType())
|
fmt.Fprintln(w, "LOCAL_SOONG_LINK_TYPE :=", c.makeLinkType)
|
||||||
if c.useVndk() {
|
if c.useVndk() {
|
||||||
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
|
||||||
}
|
}
|
||||||
|
71
cc/cc.go
71
cc/cc.go
@@ -246,14 +246,14 @@ type ModuleContextIntf interface {
|
|||||||
sdkVersion() string
|
sdkVersion() string
|
||||||
useVndk() bool
|
useVndk() bool
|
||||||
isNdk() bool
|
isNdk() bool
|
||||||
isLlndk() bool
|
isLlndk(config android.Config) bool
|
||||||
isLlndkPublic() bool
|
isLlndkPublic(config android.Config) bool
|
||||||
isVndkPrivate() bool
|
isVndkPrivate(config android.Config) bool
|
||||||
isVndk() bool
|
isVndk() bool
|
||||||
isVndkSp() bool
|
isVndkSp() bool
|
||||||
isVndkExt() bool
|
isVndkExt() bool
|
||||||
inRecovery() bool
|
inRecovery() bool
|
||||||
shouldCreateVndkSourceAbiDump() bool
|
shouldCreateVndkSourceAbiDump(config android.Config) bool
|
||||||
selectedStl() string
|
selectedStl() string
|
||||||
baseModuleName() string
|
baseModuleName() string
|
||||||
getVndkExtendsModuleName() string
|
getVndkExtendsModuleName() string
|
||||||
@@ -408,6 +408,8 @@ type Module struct {
|
|||||||
|
|
||||||
// only non-nil when this is a shared library that reuses the objects of a static library
|
// only non-nil when this is a shared library that reuses the objects of a static library
|
||||||
staticVariant *Module
|
staticVariant *Module
|
||||||
|
|
||||||
|
makeLinkType string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) OutputFile() android.OptionalPath {
|
func (c *Module) OutputFile() android.OptionalPath {
|
||||||
@@ -510,19 +512,19 @@ func (c *Module) isNdk() bool {
|
|||||||
return inList(c.Name(), ndkMigratedLibs)
|
return inList(c.Name(), ndkMigratedLibs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) isLlndk() bool {
|
func (c *Module) isLlndk(config android.Config) bool {
|
||||||
// Returns true for both LLNDK (public) and LLNDK-private libs.
|
// Returns true for both LLNDK (public) and LLNDK-private libs.
|
||||||
return inList(c.Name(), llndkLibraries)
|
return inList(c.Name(), *llndkLibraries(config))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) isLlndkPublic() bool {
|
func (c *Module) isLlndkPublic(config android.Config) bool {
|
||||||
// Returns true only for LLNDK (public) libs.
|
// Returns true only for LLNDK (public) libs.
|
||||||
return c.isLlndk() && !c.isVndkPrivate()
|
return c.isLlndk(config) && !c.isVndkPrivate(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) isVndkPrivate() bool {
|
func (c *Module) isVndkPrivate(config android.Config) bool {
|
||||||
// Returns true for LLNDK-private, VNDK-SP-private, and VNDK-core-private.
|
// Returns true for LLNDK-private, VNDK-SP-private, and VNDK-core-private.
|
||||||
return inList(c.Name(), vndkPrivateLibraries)
|
return inList(c.Name(), *vndkPrivateLibraries(config))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) isVndk() bool {
|
func (c *Module) isVndk() bool {
|
||||||
@@ -687,16 +689,16 @@ func (ctx *moduleContextImpl) isNdk() bool {
|
|||||||
return ctx.mod.isNdk()
|
return ctx.mod.isNdk()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) isLlndk() bool {
|
func (ctx *moduleContextImpl) isLlndk(config android.Config) bool {
|
||||||
return ctx.mod.isLlndk()
|
return ctx.mod.isLlndk(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) isLlndkPublic() bool {
|
func (ctx *moduleContextImpl) isLlndkPublic(config android.Config) bool {
|
||||||
return ctx.mod.isLlndkPublic()
|
return ctx.mod.isLlndkPublic(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) isVndkPrivate() bool {
|
func (ctx *moduleContextImpl) isVndkPrivate(config android.Config) bool {
|
||||||
return ctx.mod.isVndkPrivate()
|
return ctx.mod.isVndkPrivate(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) isVndk() bool {
|
func (ctx *moduleContextImpl) isVndk() bool {
|
||||||
@@ -728,7 +730,7 @@ func (ctx *moduleContextImpl) inRecovery() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check whether ABI dumps should be created for this module.
|
// Check whether ABI dumps should be created for this module.
|
||||||
func (ctx *moduleContextImpl) shouldCreateVndkSourceAbiDump() bool {
|
func (ctx *moduleContextImpl) shouldCreateVndkSourceAbiDump(config android.Config) bool {
|
||||||
if ctx.ctx.Config().IsEnvTrue("SKIP_ABI_CHECKS") {
|
if ctx.ctx.Config().IsEnvTrue("SKIP_ABI_CHECKS") {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -753,10 +755,10 @@ func (ctx *moduleContextImpl) shouldCreateVndkSourceAbiDump() bool {
|
|||||||
if ctx.isNdk() {
|
if ctx.isNdk() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if ctx.isLlndkPublic() {
|
if ctx.isLlndkPublic(config) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if ctx.useVndk() && ctx.isVndk() && !ctx.isVndkPrivate() {
|
if ctx.useVndk() && ctx.isVndk() && !ctx.isVndkPrivate(config) {
|
||||||
// Return true if this is VNDK-core, VNDK-SP, or VNDK-Ext and this is not
|
// Return true if this is VNDK-core, VNDK-SP, or VNDK-Ext and this is not
|
||||||
// VNDK-private.
|
// VNDK-private.
|
||||||
return true
|
return true
|
||||||
@@ -907,6 +909,8 @@ func orderStaticModuleDeps(module *Module, staticDeps []*Module, sharedDeps []*M
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
||||||
|
c.makeLinkType = c.getMakeLinkType(actx.Config())
|
||||||
|
|
||||||
ctx := &moduleContext{
|
ctx := &moduleContext{
|
||||||
ModuleContext: actx,
|
ModuleContext: actx,
|
||||||
moduleContextImpl: moduleContextImpl{
|
moduleContextImpl: moduleContextImpl{
|
||||||
@@ -1186,6 +1190,9 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
//
|
//
|
||||||
// The caller can then know to add the variantLibs dependencies differently from the
|
// The caller can then know to add the variantLibs dependencies differently from the
|
||||||
// nonvariantLibs
|
// nonvariantLibs
|
||||||
|
|
||||||
|
llndkLibraries := llndkLibraries(actx.Config())
|
||||||
|
vendorPublicLibraries := vendorPublicLibraries(actx.Config())
|
||||||
rewriteNdkLibs := func(list []string) (nonvariantLibs []string, variantLibs []string) {
|
rewriteNdkLibs := func(list []string) (nonvariantLibs []string, variantLibs []string) {
|
||||||
variantLibs = []string{}
|
variantLibs = []string{}
|
||||||
nonvariantLibs = []string{}
|
nonvariantLibs = []string{}
|
||||||
@@ -1198,9 +1205,9 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
} else {
|
} else {
|
||||||
variantLibs = append(variantLibs, name+ndkLibrarySuffix)
|
variantLibs = append(variantLibs, name+ndkLibrarySuffix)
|
||||||
}
|
}
|
||||||
} else if ctx.useVndk() && inList(name, llndkLibraries) {
|
} else if ctx.useVndk() && inList(name, *llndkLibraries) {
|
||||||
nonvariantLibs = append(nonvariantLibs, name+llndkLibrarySuffix)
|
nonvariantLibs = append(nonvariantLibs, name+llndkLibrarySuffix)
|
||||||
} else if (ctx.Platform() || ctx.ProductSpecific()) && inList(name, vendorPublicLibraries) {
|
} else if (ctx.Platform() || ctx.ProductSpecific()) && inList(name, *vendorPublicLibraries) {
|
||||||
vendorPublicLib := name + vendorPublicLibrarySuffix
|
vendorPublicLib := name + vendorPublicLibrarySuffix
|
||||||
if actx.OtherModuleExists(vendorPublicLib) {
|
if actx.OtherModuleExists(vendorPublicLib) {
|
||||||
nonvariantLibs = append(nonvariantLibs, vendorPublicLib)
|
nonvariantLibs = append(nonvariantLibs, vendorPublicLib)
|
||||||
@@ -1501,6 +1508,7 @@ func checkLinkType(ctx android.ModuleContext, from *Module, to *Module, tag depe
|
|||||||
// it is subject to be double loaded. Such lib should be explicitly marked as double_loadable: true
|
// it is subject to be double loaded. Such lib should be explicitly marked as double_loadable: true
|
||||||
// or as vndk-sp (vndk: { enabled: true, support_system_process: true}).
|
// or as vndk-sp (vndk: { enabled: true, support_system_process: true}).
|
||||||
func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
|
func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
|
||||||
|
llndkLibraries := llndkLibraries(ctx.Config())
|
||||||
check := func(child, parent android.Module) bool {
|
check := func(child, parent android.Module) bool {
|
||||||
to, ok := child.(*Module)
|
to, ok := child.(*Module)
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -1517,7 +1525,7 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if to.isVndkSp() || inList(child.Name(), llndkLibraries) || Bool(to.VendorProperties.Double_loadable) {
|
if to.isVndkSp() || inList(child.Name(), *llndkLibraries) || Bool(to.VendorProperties.Double_loadable) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1532,7 +1540,7 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
|
|||||||
}
|
}
|
||||||
if module, ok := ctx.Module().(*Module); ok {
|
if module, ok := ctx.Module().(*Module); ok {
|
||||||
if lib, ok := module.linker.(*libraryDecorator); ok && lib.shared() {
|
if lib, ok := module.linker.(*libraryDecorator); ok && lib.shared() {
|
||||||
if inList(ctx.ModuleName(), llndkLibraries) || Bool(module.VendorProperties.Double_loadable) {
|
if inList(ctx.ModuleName(), *llndkLibraries) || Bool(module.VendorProperties.Double_loadable) {
|
||||||
ctx.WalkDeps(check)
|
ctx.WalkDeps(check)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1546,6 +1554,9 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
directStaticDeps := []*Module{}
|
directStaticDeps := []*Module{}
|
||||||
directSharedDeps := []*Module{}
|
directSharedDeps := []*Module{}
|
||||||
|
|
||||||
|
llndkLibraries := llndkLibraries(ctx.Config())
|
||||||
|
vendorPublicLibraries := vendorPublicLibraries(ctx.Config())
|
||||||
|
|
||||||
ctx.VisitDirectDeps(func(dep android.Module) {
|
ctx.VisitDirectDeps(func(dep android.Module) {
|
||||||
depName := ctx.OtherModuleName(dep)
|
depName := ctx.OtherModuleName(dep)
|
||||||
depTag := ctx.OtherModuleDependencyTag(dep)
|
depTag := ctx.OtherModuleDependencyTag(dep)
|
||||||
@@ -1788,8 +1799,8 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
libName := strings.TrimSuffix(depName, llndkLibrarySuffix)
|
libName := strings.TrimSuffix(depName, llndkLibrarySuffix)
|
||||||
libName = strings.TrimSuffix(libName, vendorPublicLibrarySuffix)
|
libName = strings.TrimSuffix(libName, vendorPublicLibrarySuffix)
|
||||||
libName = strings.TrimPrefix(libName, "prebuilt_")
|
libName = strings.TrimPrefix(libName, "prebuilt_")
|
||||||
isLLndk := inList(libName, llndkLibraries)
|
isLLndk := inList(libName, *llndkLibraries)
|
||||||
isVendorPublicLib := inList(libName, vendorPublicLibraries)
|
isVendorPublicLib := inList(libName, *vendorPublicLibraries)
|
||||||
bothVendorAndCoreVariantsExist := ccDep.hasVendorVariant() || isLLndk
|
bothVendorAndCoreVariantsExist := ccDep.hasVendorVariant() || isLLndk
|
||||||
|
|
||||||
if ctx.DeviceConfig().VndkUseCoreVariant() && ccDep.isVndk() && !ccDep.mustUseVendorVariant() {
|
if ctx.DeviceConfig().VndkUseCoreVariant() && ccDep.isVndk() && !ccDep.mustUseVendorVariant() {
|
||||||
@@ -1919,10 +1930,12 @@ func (c *Module) staticBinary() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) getMakeLinkType() string {
|
func (c *Module) getMakeLinkType(config android.Config) string {
|
||||||
if c.useVndk() {
|
if c.useVndk() {
|
||||||
if inList(c.Name(), vndkCoreLibraries) || inList(c.Name(), vndkSpLibraries) || inList(c.Name(), llndkLibraries) {
|
if inList(c.Name(), *vndkCoreLibraries(config)) ||
|
||||||
if inList(c.Name(), vndkPrivateLibraries) {
|
inList(c.Name(), *vndkSpLibraries(config)) ||
|
||||||
|
inList(c.Name(), *llndkLibraries(config)) {
|
||||||
|
if inList(c.Name(), *vndkPrivateLibraries(config)) {
|
||||||
return "native:vndk_private"
|
return "native:vndk_private"
|
||||||
} else {
|
} else {
|
||||||
return "native:vndk"
|
return "native:vndk"
|
||||||
@@ -1937,7 +1950,7 @@ func (c *Module) getMakeLinkType() string {
|
|||||||
// TODO(b/114741097): use the correct ndk stl once build errors have been fixed
|
// TODO(b/114741097): use the correct ndk stl once build errors have been fixed
|
||||||
//family, link := getNdkStlFamilyAndLinkType(c)
|
//family, link := getNdkStlFamilyAndLinkType(c)
|
||||||
//return fmt.Sprintf("native:ndk:%s:%s", family, link)
|
//return fmt.Sprintf("native:ndk:%s:%s", family, link)
|
||||||
} else if inList(c.Name(), vndkUsingCoreVariantLibraries) {
|
} else if inList(c.Name(), *vndkUsingCoreVariantLibraries(config)) {
|
||||||
return "native:platform_vndk"
|
return "native:platform_vndk"
|
||||||
} else {
|
} else {
|
||||||
return "native:platform"
|
return "native:platform"
|
||||||
|
@@ -429,7 +429,7 @@ func (library *libraryDecorator) shouldCreateVndkSourceAbiDump(ctx ModuleContext
|
|||||||
if library.Properties.Header_abi_checker.Enabled != nil {
|
if library.Properties.Header_abi_checker.Enabled != nil {
|
||||||
return Bool(library.Properties.Header_abi_checker.Enabled)
|
return Bool(library.Properties.Header_abi_checker.Enabled)
|
||||||
}
|
}
|
||||||
return ctx.shouldCreateVndkSourceAbiDump()
|
return ctx.shouldCreateVndkSourceAbiDump(ctx.Config())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
|
func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
|
||||||
@@ -783,7 +783,7 @@ func (library *libraryDecorator) nativeCoverage() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getRefAbiDumpFile(ctx ModuleContext, vndkVersion, fileName string) android.Path {
|
func getRefAbiDumpFile(ctx ModuleContext, vndkVersion, fileName string) android.Path {
|
||||||
isLlndkOrNdk := inList(ctx.baseModuleName(), llndkLibraries) || inList(ctx.baseModuleName(), ndkMigratedLibs)
|
isLlndkOrNdk := inList(ctx.baseModuleName(), *llndkLibraries(ctx.Config())) || inList(ctx.baseModuleName(), ndkMigratedLibs)
|
||||||
|
|
||||||
refAbiDumpTextFile := android.PathForVndkRefAbiDump(ctx, vndkVersion, fileName, isLlndkOrNdk, ctx.isVndk(), false)
|
refAbiDumpTextFile := android.PathForVndkRefAbiDump(ctx, vndkVersion, fileName, isLlndkOrNdk, ctx.isVndk(), false)
|
||||||
refAbiDumpGzipFile := android.PathForVndkRefAbiDump(ctx, vndkVersion, fileName, isLlndkOrNdk, ctx.isVndk(), true)
|
refAbiDumpGzipFile := android.PathForVndkRefAbiDump(ctx, vndkVersion, fileName, isLlndkOrNdk, ctx.isVndk(), true)
|
||||||
@@ -827,7 +827,7 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
|
|||||||
refAbiDumpFile := getRefAbiDumpFile(ctx, vndkVersion, fileName)
|
refAbiDumpFile := getRefAbiDumpFile(ctx, vndkVersion, fileName)
|
||||||
if refAbiDumpFile != nil {
|
if refAbiDumpFile != nil {
|
||||||
library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
|
library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
|
||||||
refAbiDumpFile, fileName, exportedHeaderFlags, ctx.isLlndk(), ctx.isNdk(), ctx.isVndkExt())
|
refAbiDumpFile, fileName, exportedHeaderFlags, ctx.isLlndk(ctx.Config()), ctx.isNdk(), ctx.isVndkExt())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -64,6 +64,8 @@ func makeStringOfWarningAllowedProjects() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func makeVarsProvider(ctx android.MakeVarsContext) {
|
func makeVarsProvider(ctx android.MakeVarsContext) {
|
||||||
|
vendorPublicLibraries := vendorPublicLibraries(ctx.Config())
|
||||||
|
|
||||||
ctx.Strict("LLVM_RELEASE_VERSION", "${config.ClangShortVersion}")
|
ctx.Strict("LLVM_RELEASE_VERSION", "${config.ClangShortVersion}")
|
||||||
ctx.Strict("LLVM_PREBUILTS_VERSION", "${config.ClangVersion}")
|
ctx.Strict("LLVM_PREBUILTS_VERSION", "${config.ClangVersion}")
|
||||||
ctx.Strict("LLVM_PREBUILTS_BASE", "${config.ClangBase}")
|
ctx.Strict("LLVM_PREBUILTS_BASE", "${config.ClangBase}")
|
||||||
@@ -92,18 +94,18 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
|||||||
|
|
||||||
ctx.Strict("BOARD_VNDK_VERSION", ctx.DeviceConfig().VndkVersion())
|
ctx.Strict("BOARD_VNDK_VERSION", ctx.DeviceConfig().VndkVersion())
|
||||||
|
|
||||||
ctx.Strict("VNDK_CORE_LIBRARIES", strings.Join(vndkCoreLibraries, " "))
|
ctx.Strict("VNDK_CORE_LIBRARIES", strings.Join(*vndkCoreLibraries(ctx.Config()), " "))
|
||||||
ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(vndkSpLibraries, " "))
|
ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(*vndkSpLibraries(ctx.Config()), " "))
|
||||||
ctx.Strict("LLNDK_LIBRARIES", strings.Join(llndkLibraries, " "))
|
ctx.Strict("LLNDK_LIBRARIES", strings.Join(*llndkLibraries(ctx.Config()), " "))
|
||||||
ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(vndkPrivateLibraries, " "))
|
ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(*vndkPrivateLibraries(ctx.Config()), " "))
|
||||||
ctx.Strict("VNDK_USING_CORE_VARIANT_LIBRARIES", strings.Join(vndkUsingCoreVariantLibraries, " "))
|
ctx.Strict("VNDK_USING_CORE_VARIANT_LIBRARIES", strings.Join(*vndkUsingCoreVariantLibraries(ctx.Config()), " "))
|
||||||
|
|
||||||
// Filter vendor_public_library that are exported to make
|
// Filter vendor_public_library that are exported to make
|
||||||
exportedVendorPublicLibraries := []string{}
|
exportedVendorPublicLibraries := []string{}
|
||||||
ctx.VisitAllModules(func(module android.Module) {
|
ctx.VisitAllModules(func(module android.Module) {
|
||||||
if ccModule, ok := module.(*Module); ok {
|
if ccModule, ok := module.(*Module); ok {
|
||||||
baseName := ccModule.BaseModuleName()
|
baseName := ccModule.BaseModuleName()
|
||||||
if inList(baseName, vendorPublicLibraries) && module.ExportedToMake() {
|
if inList(baseName, *vendorPublicLibraries) && module.ExportedToMake() {
|
||||||
if !inList(baseName, exportedVendorPublicLibraries) {
|
if !inList(baseName, exportedVendorPublicLibraries) {
|
||||||
exportedVendorPublicLibraries = append(exportedVendorPublicLibraries, baseName)
|
exportedVendorPublicLibraries = append(exportedVendorPublicLibraries, baseName)
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,7 @@ func (sabimod *sabi) flags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
|
|
||||||
func sabiDepsMutator(mctx android.TopDownMutatorContext) {
|
func sabiDepsMutator(mctx android.TopDownMutatorContext) {
|
||||||
if c, ok := mctx.Module().(*Module); ok &&
|
if c, ok := mctx.Module().(*Module); ok &&
|
||||||
((c.isVndk() && c.useVndk()) || inList(c.Name(), llndkLibraries) ||
|
((c.isVndk() && c.useVndk()) || inList(c.Name(), *llndkLibraries(mctx.Config())) ||
|
||||||
(c.sabi != nil && c.sabi.Properties.CreateSAbiDumps)) {
|
(c.sabi != nil && c.sabi.Properties.CreateSAbiDumps)) {
|
||||||
mctx.VisitDirectDeps(func(m android.Module) {
|
mctx.VisitDirectDeps(func(m android.Module) {
|
||||||
tag := mctx.OtherModuleDependencyTag(m)
|
tag := mctx.OtherModuleDependencyTag(m)
|
||||||
|
@@ -817,7 +817,7 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if mctx.Device() && runtimeLibrary != "" {
|
if mctx.Device() && runtimeLibrary != "" {
|
||||||
if inList(runtimeLibrary, llndkLibraries) && !c.static() && c.useVndk() {
|
if inList(runtimeLibrary, *llndkLibraries(mctx.Config())) && !c.static() && c.useVndk() {
|
||||||
runtimeLibrary = runtimeLibrary + llndkLibrarySuffix
|
runtimeLibrary = runtimeLibrary + llndkLibrarySuffix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,10 +24,16 @@ import (
|
|||||||
var (
|
var (
|
||||||
vendorPublicLibrarySuffix = ".vendorpublic"
|
vendorPublicLibrarySuffix = ".vendorpublic"
|
||||||
|
|
||||||
vendorPublicLibraries = []string{}
|
vendorPublicLibrariesKey = android.NewOnceKey("vendorPublicLibraries")
|
||||||
vendorPublicLibrariesLock sync.Mutex
|
vendorPublicLibrariesLock sync.Mutex
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func vendorPublicLibraries(config android.Config) *[]string {
|
||||||
|
return config.Once(vendorPublicLibrariesKey, func() interface{} {
|
||||||
|
return &[]string{}
|
||||||
|
}).(*[]string)
|
||||||
|
}
|
||||||
|
|
||||||
// Creates a stub shared library for a vendor public library. Vendor public libraries
|
// Creates a stub shared library for a vendor public library. Vendor public libraries
|
||||||
// are vendor libraries (owned by them and installed to /vendor partition) that are
|
// are vendor libraries (owned by them and installed to /vendor partition) that are
|
||||||
// exposed to Android apps via JNI. The libraries are made public by being listed in
|
// exposed to Android apps via JNI. The libraries are made public by being listed in
|
||||||
@@ -82,12 +88,13 @@ func (stub *vendorPublicLibraryStubDecorator) compilerInit(ctx BaseModuleContext
|
|||||||
|
|
||||||
vendorPublicLibrariesLock.Lock()
|
vendorPublicLibrariesLock.Lock()
|
||||||
defer vendorPublicLibrariesLock.Unlock()
|
defer vendorPublicLibrariesLock.Unlock()
|
||||||
for _, lib := range vendorPublicLibraries {
|
vendorPublicLibraries := vendorPublicLibraries(ctx.Config())
|
||||||
|
for _, lib := range *vendorPublicLibraries {
|
||||||
if lib == name {
|
if lib == name {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vendorPublicLibraries = append(vendorPublicLibraries, name)
|
*vendorPublicLibraries = append(*vendorPublicLibraries, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (stub *vendorPublicLibraryStubDecorator) compilerFlags(ctx ModuleContext, flags Flags, deps PathDeps) Flags {
|
func (stub *vendorPublicLibraryStubDecorator) compilerFlags(ctx ModuleContext, flags Flags, deps PathDeps) Flags {
|
||||||
|
88
cc/vndk.go
88
cc/vndk.go
@@ -192,29 +192,63 @@ func vndkIsVndkDepAllowed(from *vndkdep, to *vndkdep) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
vndkCoreLibraries []string
|
vndkCoreLibrariesKey = android.NewOnceKey("vndkCoreLibrarires")
|
||||||
vndkSpLibraries []string
|
vndkSpLibrariesKey = android.NewOnceKey("vndkSpLibrarires")
|
||||||
llndkLibraries []string
|
llndkLibrariesKey = android.NewOnceKey("llndkLibrarires")
|
||||||
vndkPrivateLibraries []string
|
vndkPrivateLibrariesKey = android.NewOnceKey("vndkPrivateLibrarires")
|
||||||
vndkUsingCoreVariantLibraries []string
|
vndkUsingCoreVariantLibrariesKey = android.NewOnceKey("vndkUsingCoreVariantLibrarires")
|
||||||
vndkLibrariesLock sync.Mutex
|
vndkLibrariesLock sync.Mutex
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func vndkCoreLibraries(config android.Config) *[]string {
|
||||||
|
return config.Once(vndkCoreLibrariesKey, func() interface{} {
|
||||||
|
return &[]string{}
|
||||||
|
}).(*[]string)
|
||||||
|
}
|
||||||
|
|
||||||
|
func vndkSpLibraries(config android.Config) *[]string {
|
||||||
|
return config.Once(vndkSpLibrariesKey, func() interface{} {
|
||||||
|
return &[]string{}
|
||||||
|
}).(*[]string)
|
||||||
|
}
|
||||||
|
|
||||||
|
func llndkLibraries(config android.Config) *[]string {
|
||||||
|
return config.Once(llndkLibrariesKey, func() interface{} {
|
||||||
|
return &[]string{}
|
||||||
|
}).(*[]string)
|
||||||
|
}
|
||||||
|
|
||||||
|
func vndkPrivateLibraries(config android.Config) *[]string {
|
||||||
|
return config.Once(vndkPrivateLibrariesKey, func() interface{} {
|
||||||
|
return &[]string{}
|
||||||
|
}).(*[]string)
|
||||||
|
}
|
||||||
|
|
||||||
|
func vndkUsingCoreVariantLibraries(config android.Config) *[]string {
|
||||||
|
return config.Once(vndkUsingCoreVariantLibrariesKey, func() interface{} {
|
||||||
|
return &[]string{}
|
||||||
|
}).(*[]string)
|
||||||
|
}
|
||||||
|
|
||||||
// gather list of vndk-core, vndk-sp, and ll-ndk libs
|
// gather list of vndk-core, vndk-sp, and ll-ndk libs
|
||||||
func VndkMutator(mctx android.BottomUpMutatorContext) {
|
func VndkMutator(mctx android.BottomUpMutatorContext) {
|
||||||
if m, ok := mctx.Module().(*Module); ok && m.Enabled() {
|
if m, ok := mctx.Module().(*Module); ok && m.Enabled() {
|
||||||
if lib, ok := m.linker.(*llndkStubDecorator); ok {
|
if lib, ok := m.linker.(*llndkStubDecorator); ok {
|
||||||
vndkLibrariesLock.Lock()
|
vndkLibrariesLock.Lock()
|
||||||
defer vndkLibrariesLock.Unlock()
|
defer vndkLibrariesLock.Unlock()
|
||||||
|
|
||||||
|
llndkLibraries := llndkLibraries(mctx.Config())
|
||||||
|
vndkPrivateLibraries := vndkPrivateLibraries(mctx.Config())
|
||||||
|
|
||||||
name := strings.TrimSuffix(m.Name(), llndkLibrarySuffix)
|
name := strings.TrimSuffix(m.Name(), llndkLibrarySuffix)
|
||||||
if !inList(name, llndkLibraries) {
|
if !inList(name, *llndkLibraries) {
|
||||||
llndkLibraries = append(llndkLibraries, name)
|
*llndkLibraries = append(*llndkLibraries, name)
|
||||||
sort.Strings(llndkLibraries)
|
sort.Strings(*llndkLibraries)
|
||||||
}
|
}
|
||||||
if !Bool(lib.Properties.Vendor_available) {
|
if !Bool(lib.Properties.Vendor_available) {
|
||||||
if !inList(name, vndkPrivateLibraries) {
|
if !inList(name, *vndkPrivateLibraries) {
|
||||||
vndkPrivateLibraries = append(vndkPrivateLibraries, name)
|
*vndkPrivateLibraries = append(*vndkPrivateLibraries, name)
|
||||||
sort.Strings(vndkPrivateLibraries)
|
sort.Strings(*vndkPrivateLibraries)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -225,27 +259,33 @@ func VndkMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
if m.vndkdep.isVndk() && !m.vndkdep.isVndkExt() {
|
if m.vndkdep.isVndk() && !m.vndkdep.isVndkExt() {
|
||||||
vndkLibrariesLock.Lock()
|
vndkLibrariesLock.Lock()
|
||||||
defer vndkLibrariesLock.Unlock()
|
defer vndkLibrariesLock.Unlock()
|
||||||
|
|
||||||
|
vndkUsingCoreVariantLibraries := vndkUsingCoreVariantLibraries(mctx.Config())
|
||||||
|
vndkSpLibraries := vndkSpLibraries(mctx.Config())
|
||||||
|
vndkCoreLibraries := vndkCoreLibraries(mctx.Config())
|
||||||
|
vndkPrivateLibraries := vndkPrivateLibraries(mctx.Config())
|
||||||
|
|
||||||
if mctx.DeviceConfig().VndkUseCoreVariant() && !inList(name, config.VndkMustUseVendorVariantList) {
|
if mctx.DeviceConfig().VndkUseCoreVariant() && !inList(name, config.VndkMustUseVendorVariantList) {
|
||||||
if !inList(name, vndkUsingCoreVariantLibraries) {
|
if !inList(name, *vndkUsingCoreVariantLibraries) {
|
||||||
vndkUsingCoreVariantLibraries = append(vndkUsingCoreVariantLibraries, name)
|
*vndkUsingCoreVariantLibraries = append(*vndkUsingCoreVariantLibraries, name)
|
||||||
sort.Strings(vndkUsingCoreVariantLibraries)
|
sort.Strings(*vndkUsingCoreVariantLibraries)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if m.vndkdep.isVndkSp() {
|
if m.vndkdep.isVndkSp() {
|
||||||
if !inList(name, vndkSpLibraries) {
|
if !inList(name, *vndkSpLibraries) {
|
||||||
vndkSpLibraries = append(vndkSpLibraries, name)
|
*vndkSpLibraries = append(*vndkSpLibraries, name)
|
||||||
sort.Strings(vndkSpLibraries)
|
sort.Strings(*vndkSpLibraries)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !inList(name, vndkCoreLibraries) {
|
if !inList(name, *vndkCoreLibraries) {
|
||||||
vndkCoreLibraries = append(vndkCoreLibraries, name)
|
*vndkCoreLibraries = append(*vndkCoreLibraries, name)
|
||||||
sort.Strings(vndkCoreLibraries)
|
sort.Strings(*vndkCoreLibraries)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !Bool(m.VendorProperties.Vendor_available) {
|
if !Bool(m.VendorProperties.Vendor_available) {
|
||||||
if !inList(name, vndkPrivateLibraries) {
|
if !inList(name, *vndkPrivateLibraries) {
|
||||||
vndkPrivateLibraries = append(vndkPrivateLibraries, name)
|
*vndkPrivateLibraries = append(*vndkPrivateLibraries, name)
|
||||||
sort.Strings(vndkPrivateLibraries)
|
sort.Strings(*vndkPrivateLibraries)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user