Soong generates vndk-related .libraries.txt files
This is a follow-up CL of I9a24f6975bd4b226a94f61a13d43857dcdce6b88 Generated files are passed to make via MakeVars: - SOONG_LLNDK_LIBRARIES_FILE - SOONG_VNDKCORE_LIBRARIES_FILE - SOONG_VNDKSP_LIBRARIES_FILE - SOONG_VNDKPRIVATE_LIBRARIES_FILE - SOONG_VNDKCOREVARIANT_LIBRARIES_FILE - SOONG_VNDK_LIBRARIES_FILE Previously filenames were "guessed" from module names. Now VndkMutator stores filenames as well and generate those files with them. Bug: 142963962 Bug: 141450808 Test: m && device boots && TH Change-Id: I0c248b707188f904df60ead50059fefe90bfd17f
This commit is contained in:
@@ -93,6 +93,20 @@ func SortedStringKeys(m interface{}) []string {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SortedStringMapValues(m interface{}) []string {
|
||||||
|
v := reflect.ValueOf(m)
|
||||||
|
if v.Kind() != reflect.Map {
|
||||||
|
panic(fmt.Sprintf("%#v is not a map", m))
|
||||||
|
}
|
||||||
|
keys := v.MapKeys()
|
||||||
|
s := make([]string, 0, len(keys))
|
||||||
|
for _, key := range keys {
|
||||||
|
s = append(s, v.MapIndex(key).String())
|
||||||
|
}
|
||||||
|
sort.Strings(s)
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
func IndexList(s string, list []string) int {
|
func IndexList(s string, list []string) int {
|
||||||
for i, l := range list {
|
for i, l := range list {
|
||||||
if l == s {
|
if l == s {
|
||||||
|
18
cc/cc.go
18
cc/cc.go
@@ -745,17 +745,18 @@ func (c *Module) isNdk() bool {
|
|||||||
|
|
||||||
func (c *Module) isLlndk(config android.Config) 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.BaseModuleName(), *llndkLibraries(config))
|
return isLlndkLibrary(c.BaseModuleName(), config)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) isLlndkPublic(config android.Config) 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(config) && !c.isVndkPrivate(config)
|
name := c.BaseModuleName()
|
||||||
|
return isLlndkLibrary(name, config) && !isVndkPrivateLibrary(name, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) isVndkPrivate(config android.Config) 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.BaseModuleName(), *vndkPrivateLibraries(config))
|
return isVndkPrivateLibrary(c.BaseModuleName(), config)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) IsVndk() bool {
|
func (c *Module) IsVndk() bool {
|
||||||
@@ -1496,7 +1497,6 @@ 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())
|
vendorPublicLibraries := vendorPublicLibraries(actx.Config())
|
||||||
rewriteNdkLibs := func(list []string) (nonvariantLibs []string, variantLibs []string) {
|
rewriteNdkLibs := func(list []string) (nonvariantLibs []string, variantLibs []string) {
|
||||||
variantLibs = []string{}
|
variantLibs = []string{}
|
||||||
@@ -1510,7 +1510,7 @@ 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() && isLlndkLibrary(name, ctx.Config()) {
|
||||||
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
|
||||||
@@ -1820,7 +1820,6 @@ func checkLinkType(ctx android.ModuleContext, from LinkableInterface, to Linkabl
|
|||||||
// 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 {
|
||||||
@@ -1837,7 +1836,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() || to.isLlndk(ctx.Config()) || Bool(to.VendorProperties.Double_loadable) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1852,7 +1851,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 module.isLlndk(ctx.Config()) || Bool(module.VendorProperties.Double_loadable) {
|
||||||
ctx.WalkDeps(check)
|
ctx.WalkDeps(check)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1866,7 +1865,6 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
directStaticDeps := []LinkableInterface{}
|
directStaticDeps := []LinkableInterface{}
|
||||||
directSharedDeps := []LinkableInterface{}
|
directSharedDeps := []LinkableInterface{}
|
||||||
|
|
||||||
llndkLibraries := llndkLibraries(ctx.Config())
|
|
||||||
vendorPublicLibraries := vendorPublicLibraries(ctx.Config())
|
vendorPublicLibraries := vendorPublicLibraries(ctx.Config())
|
||||||
|
|
||||||
reexportExporter := func(exporter exportedFlagsProducer) {
|
reexportExporter := func(exporter exportedFlagsProducer) {
|
||||||
@@ -2138,7 +2136,7 @@ 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 := isLlndkLibrary(libName, ctx.Config())
|
||||||
isVendorPublicLib := inList(libName, *vendorPublicLibraries)
|
isVendorPublicLib := inList(libName, *vendorPublicLibraries)
|
||||||
bothVendorAndCoreVariantsExist := ccDep.HasVendorVariant() || isLLndk
|
bothVendorAndCoreVariantsExist := ccDep.HasVendorVariant() || isLLndk
|
||||||
|
|
||||||
|
@@ -293,6 +293,7 @@ func TestVndk(t *testing.T) {
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
|
stem: "libvndk-private",
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
@@ -303,6 +304,7 @@ func TestVndk(t *testing.T) {
|
|||||||
support_system_process: true,
|
support_system_process: true,
|
||||||
},
|
},
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
|
suffix: "-x",
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
@@ -313,6 +315,11 @@ func TestVndk(t *testing.T) {
|
|||||||
support_system_process: true,
|
support_system_process: true,
|
||||||
},
|
},
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
|
target: {
|
||||||
|
vendor: {
|
||||||
|
suffix: "-x",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
`, config)
|
`, config)
|
||||||
|
|
||||||
@@ -345,9 +352,9 @@ func TestVndk(t *testing.T) {
|
|||||||
checkVndkSnapshot(t, ctx, "libvndk_sp", vndkSpLib2ndPath, variant2nd)
|
checkVndkSnapshot(t, ctx, "libvndk_sp", vndkSpLib2ndPath, variant2nd)
|
||||||
|
|
||||||
checkVndkOutput(t, ctx, "vndk/llndk.libraries.txt", []string{"libc.so", "libdl.so", "libft2.so", "libm.so"})
|
checkVndkOutput(t, ctx, "vndk/llndk.libraries.txt", []string{"libc.so", "libdl.so", "libft2.so", "libm.so"})
|
||||||
checkVndkOutput(t, ctx, "vndk/vndkcore.libraries.txt", []string{"libvndk.so", "libvndk_private.so"})
|
checkVndkOutput(t, ctx, "vndk/vndkcore.libraries.txt", []string{"libvndk-private.so", "libvndk.so"})
|
||||||
checkVndkOutput(t, ctx, "vndk/vndkprivate.libraries.txt", []string{"libft2.so", "libvndk_private.so", "libvndk_sp_private.so"})
|
checkVndkOutput(t, ctx, "vndk/vndkprivate.libraries.txt", []string{"libft2.so", "libvndk-private.so", "libvndk_sp_private-x.so"})
|
||||||
checkVndkOutput(t, ctx, "vndk/vndksp.libraries.txt", []string{"libc++.so", "libvndk_sp.so", "libvndk_sp_private.so"})
|
checkVndkOutput(t, ctx, "vndk/vndksp.libraries.txt", []string{"libc++.so", "libvndk_sp-x.so", "libvndk_sp_private-x.so"})
|
||||||
checkVndkOutput(t, ctx, "vndk/vndkcorevariant.libraries.txt", nil)
|
checkVndkOutput(t, ctx, "vndk/vndkcorevariant.libraries.txt", nil)
|
||||||
// merged & tagged & filtered-out(libclang_rt)
|
// merged & tagged & filtered-out(libclang_rt)
|
||||||
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
|
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
|
||||||
@@ -356,14 +363,27 @@ func TestVndk(t *testing.T) {
|
|||||||
"LLNDK: libft2.so",
|
"LLNDK: libft2.so",
|
||||||
"LLNDK: libm.so",
|
"LLNDK: libm.so",
|
||||||
"VNDK-SP: libc++.so",
|
"VNDK-SP: libc++.so",
|
||||||
"VNDK-SP: libvndk_sp.so",
|
"VNDK-SP: libvndk_sp-x.so",
|
||||||
"VNDK-SP: libvndk_sp_private.so",
|
"VNDK-SP: libvndk_sp_private-x.so",
|
||||||
|
"VNDK-core: libvndk-private.so",
|
||||||
"VNDK-core: libvndk.so",
|
"VNDK-core: libvndk.so",
|
||||||
"VNDK-core: libvndk_private.so",
|
|
||||||
"VNDK-private: libft2.so",
|
"VNDK-private: libft2.so",
|
||||||
"VNDK-private: libvndk_private.so",
|
"VNDK-private: libvndk-private.so",
|
||||||
"VNDK-private: libvndk_sp_private.so",
|
"VNDK-private: libvndk_sp_private-x.so",
|
||||||
})
|
})
|
||||||
|
checkVndkOutput(t, ctx, "vndk/llndk.libraries.txt", []string{
|
||||||
|
"libc.so", "libdl.so", "libft2.so", "libm.so",
|
||||||
|
})
|
||||||
|
checkVndkOutput(t, ctx, "vndk/vndkcore.libraries.txt", []string{
|
||||||
|
"libvndk-private.so", "libvndk.so",
|
||||||
|
})
|
||||||
|
checkVndkOutput(t, ctx, "vndk/vndksp.libraries.txt", []string{
|
||||||
|
"libc++.so", "libvndk_sp-x.so", "libvndk_sp_private-x.so",
|
||||||
|
})
|
||||||
|
checkVndkOutput(t, ctx, "vndk/vndkprivate.libraries.txt", []string{
|
||||||
|
"libft2.so", "libvndk-private.so", "libvndk_sp_private-x.so",
|
||||||
|
})
|
||||||
|
checkVndkOutput(t, ctx, "vndk/vndkcorevariant.libraries.txt", []string{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVndkUsingCoreVariant(t *testing.T) {
|
func TestVndkUsingCoreVariant(t *testing.T) {
|
||||||
@@ -405,7 +425,36 @@ func TestVndkUsingCoreVariant(t *testing.T) {
|
|||||||
`, config)
|
`, config)
|
||||||
|
|
||||||
checkVndkOutput(t, ctx, "vndk/vndkcore.libraries.txt", []string{"libvndk.so", "libvndk2.so"})
|
checkVndkOutput(t, ctx, "vndk/vndkcore.libraries.txt", []string{"libvndk.so", "libvndk2.so"})
|
||||||
checkVndkOutput(t, ctx, "vndk/vndkcorevariant.libraries.txt", []string{"libvndk2.so"})
|
checkVndkOutput(t, ctx, "vndk/vndkcorevariant.libraries.txt", []string{
|
||||||
|
"libc++.so", "libvndk2.so", "libvndk_sp.so",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
|
||||||
|
config := android.TestArchConfig(buildDir, nil)
|
||||||
|
config.TestProductVariables.DeviceVndkVersion = nil
|
||||||
|
config.TestProductVariables.Platform_vndk_version = nil
|
||||||
|
|
||||||
|
ctx := testCcWithConfig(t, `
|
||||||
|
cc_library {
|
||||||
|
name: "libvndk",
|
||||||
|
vendor_available: true,
|
||||||
|
vndk: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
nocrt: true,
|
||||||
|
}
|
||||||
|
`, config)
|
||||||
|
|
||||||
|
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
|
||||||
|
"LLNDK: libc.so",
|
||||||
|
"LLNDK: libdl.so",
|
||||||
|
"LLNDK: libft2.so",
|
||||||
|
"LLNDK: libm.so",
|
||||||
|
"VNDK-SP: libc++.so",
|
||||||
|
"VNDK-core: libvndk.so",
|
||||||
|
"VNDK-private: libft2.so",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVndkDepError(t *testing.T) {
|
func TestVndkDepError(t *testing.T) {
|
||||||
@@ -1431,13 +1480,13 @@ func TestMakeLinkType(t *testing.T) {
|
|||||||
symbol_file: "",
|
symbol_file: "",
|
||||||
}`, config)
|
}`, config)
|
||||||
|
|
||||||
assertArrayString(t, *vndkCoreLibraries(config),
|
assertMapKeys(t, vndkCoreLibraries(config),
|
||||||
[]string{"libvndk", "libvndkprivate"})
|
[]string{"libvndk", "libvndkprivate"})
|
||||||
assertArrayString(t, *vndkSpLibraries(config),
|
assertMapKeys(t, vndkSpLibraries(config),
|
||||||
[]string{"libc++", "libvndksp"})
|
[]string{"libc++", "libvndksp"})
|
||||||
assertArrayString(t, *llndkLibraries(config),
|
assertMapKeys(t, llndkLibraries(config),
|
||||||
[]string{"libc", "libdl", "libft2", "libllndk", "libllndkprivate", "libm"})
|
[]string{"libc", "libdl", "libft2", "libllndk", "libllndkprivate", "libm"})
|
||||||
assertArrayString(t, *vndkPrivateLibraries(config),
|
assertMapKeys(t, vndkPrivateLibraries(config),
|
||||||
[]string{"libft2", "libllndkprivate", "libvndkprivate"})
|
[]string{"libft2", "libllndkprivate", "libvndkprivate"})
|
||||||
|
|
||||||
vendorVariant27 := "android_arm64_armv8-a_vendor.27_shared"
|
vendorVariant27 := "android_arm64_armv8-a_vendor.27_shared"
|
||||||
@@ -2419,6 +2468,11 @@ func assertArrayString(t *testing.T, got, expected []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func assertMapKeys(t *testing.T, m map[string]string, expected []string) {
|
||||||
|
t.Helper()
|
||||||
|
assertArrayString(t, android.SortedStringKeys(m), expected)
|
||||||
|
}
|
||||||
|
|
||||||
func TestDefaults(t *testing.T) {
|
func TestDefaults(t *testing.T) {
|
||||||
ctx := testCc(t, `
|
ctx := testCc(t, `
|
||||||
cc_defaults {
|
cc_defaults {
|
||||||
|
@@ -579,24 +579,28 @@ type libraryInterface interface {
|
|||||||
availableFor(string) bool
|
availableFor(string) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (library *libraryDecorator) getLibName(ctx BaseModuleContext) string {
|
func (library *libraryDecorator) getLibNameHelper(baseModuleName string, useVndk bool) string {
|
||||||
name := library.libName
|
name := library.libName
|
||||||
if name == "" {
|
if name == "" {
|
||||||
name = String(library.Properties.Stem)
|
name = String(library.Properties.Stem)
|
||||||
if name == "" {
|
if name == "" {
|
||||||
name = ctx.baseModuleName()
|
name = baseModuleName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suffix := ""
|
suffix := ""
|
||||||
if ctx.useVndk() {
|
if useVndk {
|
||||||
suffix = String(library.Properties.Target.Vendor.Suffix)
|
suffix = String(library.Properties.Target.Vendor.Suffix)
|
||||||
}
|
}
|
||||||
if suffix == "" {
|
if suffix == "" {
|
||||||
suffix = String(library.Properties.Suffix)
|
suffix = String(library.Properties.Suffix)
|
||||||
}
|
}
|
||||||
|
|
||||||
name += suffix
|
return name + suffix
|
||||||
|
}
|
||||||
|
|
||||||
|
func (library *libraryDecorator) getLibName(ctx BaseModuleContext) string {
|
||||||
|
name := library.getLibNameHelper(ctx.baseModuleName(), ctx.useVndk())
|
||||||
|
|
||||||
if ctx.isVndkExt() {
|
if ctx.isVndkExt() {
|
||||||
// vndk-ext lib should have the same name with original lib
|
// vndk-ext lib should have the same name with original lib
|
||||||
|
@@ -101,35 +101,6 @@ 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.Config()), " "))
|
|
||||||
ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(*vndkSpLibraries(ctx.Config()), " "))
|
|
||||||
|
|
||||||
// Make uses LLNDK_LIBRARIES to determine which libraries to install.
|
|
||||||
// HWASAN is only part of the LL-NDK in builds in which libc depends on HWASAN.
|
|
||||||
// Therefore, by removing the library here, we cause it to only be installed if libc
|
|
||||||
// depends on it.
|
|
||||||
installedLlndkLibraries := []string{}
|
|
||||||
|
|
||||||
// Make uses LLNDK_MOVED_TO_APEX_LIBRARIES to avoid installing libraries on /system if
|
|
||||||
// they been moved to an apex.
|
|
||||||
movedToApexLlndkLibraries := []string{}
|
|
||||||
for _, lib := range *llndkLibraries(ctx.Config()) {
|
|
||||||
if strings.HasPrefix(lib, "libclang_rt.hwasan-") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
installedLlndkLibraries = append(installedLlndkLibraries, lib)
|
|
||||||
|
|
||||||
// Skip bionic libs, they are handled in different manner
|
|
||||||
if android.DirectlyInAnyApex(¬OnHostContext{}, lib) && !isBionic(lib) {
|
|
||||||
movedToApexLlndkLibraries = append(movedToApexLlndkLibraries, lib)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ctx.Strict("LLNDK_LIBRARIES", strings.Join(installedLlndkLibraries, " "))
|
|
||||||
ctx.Strict("LLNDK_MOVED_TO_APEX_LIBRARIES", strings.Join(movedToApexLlndkLibraries, " "))
|
|
||||||
|
|
||||||
ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(*vndkPrivateLibraries(ctx.Config()), " "))
|
|
||||||
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) {
|
||||||
|
@@ -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(mctx.Config())) ||
|
((c.IsVndk() && c.UseVndk()) || c.isLlndk(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)
|
||||||
|
@@ -873,7 +873,7 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if mctx.Device() && runtimeLibrary != "" {
|
if mctx.Device() && runtimeLibrary != "" {
|
||||||
if inList(runtimeLibrary, *llndkLibraries(mctx.Config())) && !c.static() && c.UseVndk() {
|
if isLlndkLibrary(runtimeLibrary, mctx.Config()) && !c.static() && c.UseVndk() {
|
||||||
runtimeLibrary = runtimeLibrary + llndkLibrarySuffix
|
runtimeLibrary = runtimeLibrary + llndkLibrarySuffix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
246
cc/vndk.go
246
cc/vndk.go
@@ -17,8 +17,8 @@ package cc
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@@ -208,34 +208,44 @@ var (
|
|||||||
headerExts = []string{".h", ".hh", ".hpp", ".hxx", ".h++", ".inl", ".inc", ".ipp", ".h.generic"}
|
headerExts = []string{".h", ".hh", ".hpp", ".hxx", ".h++", ".inl", ".inc", ".ipp", ".h.generic"}
|
||||||
)
|
)
|
||||||
|
|
||||||
func vndkCoreLibraries(config android.Config) *[]string {
|
func vndkCoreLibraries(config android.Config) map[string]string {
|
||||||
return config.Once(vndkCoreLibrariesKey, func() interface{} {
|
return config.Once(vndkCoreLibrariesKey, func() interface{} {
|
||||||
return &[]string{}
|
return make(map[string]string)
|
||||||
}).(*[]string)
|
}).(map[string]string)
|
||||||
}
|
}
|
||||||
|
|
||||||
func vndkSpLibraries(config android.Config) *[]string {
|
func vndkSpLibraries(config android.Config) map[string]string {
|
||||||
return config.Once(vndkSpLibrariesKey, func() interface{} {
|
return config.Once(vndkSpLibrariesKey, func() interface{} {
|
||||||
return &[]string{}
|
return make(map[string]string)
|
||||||
}).(*[]string)
|
}).(map[string]string)
|
||||||
}
|
}
|
||||||
|
|
||||||
func llndkLibraries(config android.Config) *[]string {
|
func isLlndkLibrary(baseModuleName string, config android.Config) bool {
|
||||||
|
_, ok := llndkLibraries(config)[baseModuleName]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
func llndkLibraries(config android.Config) map[string]string {
|
||||||
return config.Once(llndkLibrariesKey, func() interface{} {
|
return config.Once(llndkLibrariesKey, func() interface{} {
|
||||||
return &[]string{}
|
return make(map[string]string)
|
||||||
}).(*[]string)
|
}).(map[string]string)
|
||||||
}
|
}
|
||||||
|
|
||||||
func vndkPrivateLibraries(config android.Config) *[]string {
|
func isVndkPrivateLibrary(baseModuleName string, config android.Config) bool {
|
||||||
|
_, ok := vndkPrivateLibraries(config)[baseModuleName]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
func vndkPrivateLibraries(config android.Config) map[string]string {
|
||||||
return config.Once(vndkPrivateLibrariesKey, func() interface{} {
|
return config.Once(vndkPrivateLibrariesKey, func() interface{} {
|
||||||
return &[]string{}
|
return make(map[string]string)
|
||||||
}).(*[]string)
|
}).(map[string]string)
|
||||||
}
|
}
|
||||||
|
|
||||||
func vndkUsingCoreVariantLibraries(config android.Config) *[]string {
|
func vndkUsingCoreVariantLibraries(config android.Config) map[string]string {
|
||||||
return config.Once(vndkUsingCoreVariantLibrariesKey, func() interface{} {
|
return config.Once(vndkUsingCoreVariantLibrariesKey, func() interface{} {
|
||||||
return &[]string{}
|
return make(map[string]string)
|
||||||
}).(*[]string)
|
}).(map[string]string)
|
||||||
}
|
}
|
||||||
|
|
||||||
func modulePaths(config android.Config) map[string]string {
|
func modulePaths(config android.Config) map[string]string {
|
||||||
@@ -272,63 +282,44 @@ func setVndkMustUseVendorVariantListForTest(config android.Config, mustUseVendor
|
|||||||
|
|
||||||
func processLlndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
|
func processLlndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
|
||||||
lib := m.linker.(*llndkStubDecorator)
|
lib := m.linker.(*llndkStubDecorator)
|
||||||
name := strings.TrimSuffix(m.Name(), llndkLibrarySuffix)
|
name := m.BaseModuleName()
|
||||||
|
filename := m.BaseModuleName() + ".so"
|
||||||
|
|
||||||
vndkLibrariesLock.Lock()
|
vndkLibrariesLock.Lock()
|
||||||
defer vndkLibrariesLock.Unlock()
|
defer vndkLibrariesLock.Unlock()
|
||||||
|
|
||||||
llndkLibraries := llndkLibraries(mctx.Config())
|
llndkLibraries(mctx.Config())[name] = filename
|
||||||
if !inList(name, *llndkLibraries) {
|
|
||||||
*llndkLibraries = append(*llndkLibraries, name)
|
|
||||||
sort.Strings(*llndkLibraries)
|
|
||||||
}
|
|
||||||
if !Bool(lib.Properties.Vendor_available) {
|
if !Bool(lib.Properties.Vendor_available) {
|
||||||
vndkPrivateLibraries := vndkPrivateLibraries(mctx.Config())
|
vndkPrivateLibraries(mctx.Config())[name] = filename
|
||||||
if !inList(name, *vndkPrivateLibraries) {
|
|
||||||
*vndkPrivateLibraries = append(*vndkPrivateLibraries, name)
|
|
||||||
sort.Strings(*vndkPrivateLibraries)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
|
func processVndkLibrary(mctx android.BottomUpMutatorContext, m *Module) {
|
||||||
name := strings.TrimPrefix(m.Name(), "prebuilt_")
|
name := m.BaseModuleName()
|
||||||
|
filename, err := getVndkFileName(m)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
vndkLibrariesLock.Lock()
|
vndkLibrariesLock.Lock()
|
||||||
defer vndkLibrariesLock.Unlock()
|
defer vndkLibrariesLock.Unlock()
|
||||||
|
|
||||||
modulePaths := modulePaths(mctx.Config())
|
modulePaths(mctx.Config())[name] = mctx.ModuleDir()
|
||||||
|
|
||||||
if inList(name, vndkMustUseVendorVariantList(mctx.Config())) {
|
if inList(name, vndkMustUseVendorVariantList(mctx.Config())) {
|
||||||
m.Properties.MustUseVendorVariant = true
|
m.Properties.MustUseVendorVariant = true
|
||||||
}
|
}
|
||||||
if mctx.DeviceConfig().VndkUseCoreVariant() && !inList(name, vndkMustUseVendorVariantList(mctx.Config())) {
|
if mctx.DeviceConfig().VndkUseCoreVariant() && !m.Properties.MustUseVendorVariant {
|
||||||
vndkUsingCoreVariantLibraries := vndkUsingCoreVariantLibraries(mctx.Config())
|
vndkUsingCoreVariantLibraries(mctx.Config())[name] = filename
|
||||||
if !inList(name, *vndkUsingCoreVariantLibraries) {
|
|
||||||
*vndkUsingCoreVariantLibraries = append(*vndkUsingCoreVariantLibraries, name)
|
|
||||||
sort.Strings(*vndkUsingCoreVariantLibraries)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.vndkdep.isVndkSp() {
|
if m.vndkdep.isVndkSp() {
|
||||||
vndkSpLibraries := vndkSpLibraries(mctx.Config())
|
vndkSpLibraries(mctx.Config())[name] = filename
|
||||||
if !inList(name, *vndkSpLibraries) {
|
|
||||||
*vndkSpLibraries = append(*vndkSpLibraries, name)
|
|
||||||
sort.Strings(*vndkSpLibraries)
|
|
||||||
modulePaths[name] = mctx.ModuleDir()
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
vndkCoreLibraries := vndkCoreLibraries(mctx.Config())
|
vndkCoreLibraries(mctx.Config())[name] = filename
|
||||||
if !inList(name, *vndkCoreLibraries) {
|
|
||||||
*vndkCoreLibraries = append(*vndkCoreLibraries, name)
|
|
||||||
sort.Strings(*vndkCoreLibraries)
|
|
||||||
modulePaths[name] = mctx.ModuleDir()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if !Bool(m.VendorProperties.Vendor_available) {
|
if !Bool(m.VendorProperties.Vendor_available) {
|
||||||
vndkPrivateLibraries := vndkPrivateLibraries(mctx.Config())
|
vndkPrivateLibraries(mctx.Config())[name] = filename
|
||||||
if !inList(name, *vndkPrivateLibraries) {
|
|
||||||
*vndkPrivateLibraries = append(*vndkPrivateLibraries, name)
|
|
||||||
sort.Strings(*vndkPrivateLibraries)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,9 +393,20 @@ func VndkSnapshotSingleton() android.Singleton {
|
|||||||
return &vndkSnapshotSingleton{}
|
return &vndkSnapshotSingleton{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type vndkSnapshotSingleton struct{}
|
type vndkSnapshotSingleton struct {
|
||||||
|
installedLlndkLibraries []string
|
||||||
|
llnkdLibrariesFile android.Path
|
||||||
|
vndkSpLibrariesFile android.Path
|
||||||
|
vndkCoreLibrariesFile android.Path
|
||||||
|
vndkPrivateLibrariesFile android.Path
|
||||||
|
vndkCoreVariantLibrariesFile android.Path
|
||||||
|
vndkLibrariesFile android.Path
|
||||||
|
}
|
||||||
|
|
||||||
func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
||||||
|
// build these files even if PlatformVndkVersion or BoardVndkVersion is not set
|
||||||
|
c.buildVndkLibrariesTxtFiles(ctx)
|
||||||
|
|
||||||
// BOARD_VNDK_VERSION must be set to 'current' in order to generate a VNDK snapshot.
|
// BOARD_VNDK_VERSION must be set to 'current' in order to generate a VNDK snapshot.
|
||||||
if ctx.DeviceConfig().VndkVersion() != "current" {
|
if ctx.DeviceConfig().VndkVersion() != "current" {
|
||||||
return
|
return
|
||||||
@@ -418,8 +420,6 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.buildVndkLibrariesTxtFiles(ctx)
|
|
||||||
|
|
||||||
outputs := vndkSnapshotOutputs(ctx.Config())
|
outputs := vndkSnapshotOutputs(ctx.Config())
|
||||||
|
|
||||||
snapshotDir := "vndk-snapshot"
|
snapshotDir := "vndk-snapshot"
|
||||||
@@ -488,9 +488,9 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vndkCoreLibraries := vndkCoreLibraries(ctx.Config())
|
vndkCoreLibraries := android.SortedStringKeys(vndkCoreLibraries(ctx.Config()))
|
||||||
vndkSpLibraries := vndkSpLibraries(ctx.Config())
|
vndkSpLibraries := android.SortedStringKeys(vndkSpLibraries(ctx.Config()))
|
||||||
vndkPrivateLibraries := vndkPrivateLibraries(ctx.Config())
|
vndkPrivateLibraries := android.SortedStringKeys(vndkPrivateLibraries(ctx.Config()))
|
||||||
|
|
||||||
var generatedHeaders android.Paths
|
var generatedHeaders android.Paths
|
||||||
includeDirs := make(map[string]bool)
|
includeDirs := make(map[string]bool)
|
||||||
@@ -547,9 +547,9 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
|||||||
return nil, "", false
|
return nil, "", false
|
||||||
}
|
}
|
||||||
name := ctx.ModuleName(m)
|
name := ctx.ModuleName(m)
|
||||||
if inList(name, *vndkCoreLibraries) {
|
if inList(name, vndkCoreLibraries) {
|
||||||
return l, filepath.Join("shared", "vndk-core"), true
|
return l, filepath.Join("shared", "vndk-core"), true
|
||||||
} else if inList(name, *vndkSpLibraries) {
|
} else if inList(name, vndkSpLibraries) {
|
||||||
return l, filepath.Join("shared", "vndk-sp"), true
|
return l, filepath.Join("shared", "vndk-sp"), true
|
||||||
} else {
|
} else {
|
||||||
return nil, "", false
|
return nil, "", false
|
||||||
@@ -635,9 +635,9 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
installSnapshotFileFromContent(android.JoinWithSuffix(*vndkCoreLibraries, ".so", "\\n"),
|
installSnapshotFileFromContent(android.JoinWithSuffix(vndkCoreLibraries, ".so", "\\n"),
|
||||||
filepath.Join(configsDir, "vndkcore.libraries.txt"))
|
filepath.Join(configsDir, "vndkcore.libraries.txt"))
|
||||||
installSnapshotFileFromContent(android.JoinWithSuffix(*vndkPrivateLibraries, ".so", "\\n"),
|
installSnapshotFileFromContent(android.JoinWithSuffix(vndkPrivateLibraries, ".so", "\\n"),
|
||||||
filepath.Join(configsDir, "vndkprivate.libraries.txt"))
|
filepath.Join(configsDir, "vndkprivate.libraries.txt"))
|
||||||
|
|
||||||
var modulePathTxtBuilder strings.Builder
|
var modulePathTxtBuilder strings.Builder
|
||||||
@@ -660,8 +660,31 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
|||||||
filepath.Join(configsDir, "module_paths.txt"))
|
filepath.Join(configsDir, "module_paths.txt"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func installListFile(ctx android.SingletonContext, list []string, pathComponents ...string) android.OutputPath {
|
func getVndkFileName(m *Module) (string, error) {
|
||||||
out := android.PathForOutput(ctx, pathComponents...)
|
if library, ok := m.linker.(*libraryDecorator); ok {
|
||||||
|
return library.getLibNameHelper(m.BaseModuleName(), true) + ".so", nil
|
||||||
|
}
|
||||||
|
if prebuilt, ok := m.linker.(*prebuiltLibraryLinker); ok {
|
||||||
|
return prebuilt.libraryDecorator.getLibNameHelper(m.BaseModuleName(), true) + ".so", nil
|
||||||
|
}
|
||||||
|
return "", fmt.Errorf("VNDK library should have libraryDecorator or prebuiltLibraryLinker as linker: %T", m.linker)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *vndkSnapshotSingleton) buildVndkLibrariesTxtFiles(ctx android.SingletonContext) {
|
||||||
|
// Make uses LLNDK_LIBRARIES to determine which libraries to install.
|
||||||
|
// HWASAN is only part of the LL-NDK in builds in which libc depends on HWASAN.
|
||||||
|
// Therefore, by removing the library here, we cause it to only be installed if libc
|
||||||
|
// depends on it.
|
||||||
|
installedLlndkLibraries := make(map[string]string)
|
||||||
|
for lib, filename := range llndkLibraries(ctx.Config()) {
|
||||||
|
if strings.HasPrefix(lib, "libclang_rt.hwasan-") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
installedLlndkLibraries[lib] = filename
|
||||||
|
}
|
||||||
|
|
||||||
|
installListFile := func(list []string, fileName string) android.Path {
|
||||||
|
out := android.PathForOutput(ctx, "vndk", fileName)
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: android.WriteFile,
|
Rule: android.WriteFile,
|
||||||
Output: out,
|
Output: out,
|
||||||
@@ -671,64 +694,26 @@ func installListFile(ctx android.SingletonContext, list []string, pathComponents
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
return out
|
return out
|
||||||
}
|
|
||||||
|
|
||||||
func (c *vndkSnapshotSingleton) buildVndkLibrariesTxtFiles(ctx android.SingletonContext) {
|
|
||||||
var (
|
|
||||||
llndk, vndkcore, vndksp, vndkprivate, vndkcorevariant, merged []string
|
|
||||||
)
|
|
||||||
vndkVersion := ctx.DeviceConfig().PlatformVndkVersion()
|
|
||||||
config := ctx.Config()
|
|
||||||
ctx.VisitAllModules(func(m android.Module) {
|
|
||||||
if !m.Enabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c, ok := m.(*Module)
|
|
||||||
if !ok || c.Os().Class != android.Device {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
lib, ok := c.linker.(interface{ shared() bool })
|
|
||||||
if !ok || !lib.shared() {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !c.OutputFile().Valid() {
|
c.installedLlndkLibraries = android.SortedStringKeys(installedLlndkLibraries)
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
filename := c.OutputFile().Path().Base()
|
llndk := android.SortedStringMapValues(installedLlndkLibraries)
|
||||||
if c.isLlndk(config) {
|
vndkcore := android.SortedStringMapValues(vndkCoreLibraries(ctx.Config()))
|
||||||
llndk = append(llndk, filename)
|
vndksp := android.SortedStringMapValues(vndkSpLibraries(ctx.Config()))
|
||||||
if c.isVndkPrivate(config) {
|
vndkprivate := android.SortedStringMapValues(vndkPrivateLibraries(ctx.Config()))
|
||||||
vndkprivate = append(vndkprivate, filename)
|
vndkcorevariant := android.SortedStringMapValues(vndkUsingCoreVariantLibraries(ctx.Config()))
|
||||||
}
|
|
||||||
} else if c.vndkVersion() == vndkVersion && c.IsVndk() && !c.isVndkExt() {
|
|
||||||
if c.isVndkSp() {
|
|
||||||
vndksp = append(vndksp, filename)
|
|
||||||
} else {
|
|
||||||
vndkcore = append(vndkcore, filename)
|
|
||||||
}
|
|
||||||
if c.isVndkPrivate(config) {
|
|
||||||
vndkprivate = append(vndkprivate, filename)
|
|
||||||
}
|
|
||||||
if ctx.DeviceConfig().VndkUseCoreVariant() && !c.MustUseVendorVariant() {
|
|
||||||
vndkcorevariant = append(vndkcorevariant, filename)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
llndk = android.SortedUniqueStrings(llndk)
|
|
||||||
vndkcore = android.SortedUniqueStrings(vndkcore)
|
|
||||||
vndksp = android.SortedUniqueStrings(vndksp)
|
|
||||||
vndkprivate = android.SortedUniqueStrings(vndkprivate)
|
|
||||||
vndkcorevariant = android.SortedUniqueStrings(vndkcorevariant)
|
|
||||||
|
|
||||||
installListFile(ctx, llndk, "vndk", "llndk.libraries.txt")
|
c.llnkdLibrariesFile = installListFile(llndk, "llndk.libraries.txt")
|
||||||
installListFile(ctx, vndkcore, "vndk", "vndkcore.libraries.txt")
|
c.vndkCoreLibrariesFile = installListFile(vndkcore, "vndkcore.libraries.txt")
|
||||||
installListFile(ctx, vndksp, "vndk", "vndksp.libraries.txt")
|
c.vndkSpLibrariesFile = installListFile(vndksp, "vndksp.libraries.txt")
|
||||||
installListFile(ctx, vndkprivate, "vndk", "vndkprivate.libraries.txt")
|
c.vndkPrivateLibrariesFile = installListFile(vndkprivate, "vndkprivate.libraries.txt")
|
||||||
installListFile(ctx, vndkcorevariant, "vndk", "vndkcorevariant.libraries.txt")
|
c.vndkCoreVariantLibrariesFile = installListFile(vndkcorevariant, "vndkcorevariant.libraries.txt")
|
||||||
|
|
||||||
// merged & tagged & filtered-out(libclang_rt)
|
// merged & tagged & filtered-out(libclang_rt)
|
||||||
|
// Since each target have different set of libclang_rt.* files,
|
||||||
|
// keep the common set of files in vndk.libraries.txt
|
||||||
|
var merged []string
|
||||||
filterOutLibClangRt := func(libList []string) (filtered []string) {
|
filterOutLibClangRt := func(libList []string) (filtered []string) {
|
||||||
for _, lib := range libList {
|
for _, lib := range libList {
|
||||||
if !strings.HasPrefix(lib, "libclang_rt.") {
|
if !strings.HasPrefix(lib, "libclang_rt.") {
|
||||||
@@ -741,6 +726,31 @@ func (c *vndkSnapshotSingleton) buildVndkLibrariesTxtFiles(ctx android.Singleton
|
|||||||
merged = append(merged, addPrefix(vndksp, "VNDK-SP: ")...)
|
merged = append(merged, addPrefix(vndksp, "VNDK-SP: ")...)
|
||||||
merged = append(merged, addPrefix(filterOutLibClangRt(vndkcore), "VNDK-core: ")...)
|
merged = append(merged, addPrefix(filterOutLibClangRt(vndkcore), "VNDK-core: ")...)
|
||||||
merged = append(merged, addPrefix(vndkprivate, "VNDK-private: ")...)
|
merged = append(merged, addPrefix(vndkprivate, "VNDK-private: ")...)
|
||||||
|
c.vndkLibrariesFile = installListFile(merged, "vndk.libraries.txt")
|
||||||
installListFile(ctx, merged, "vndk", "vndk.libraries.txt")
|
}
|
||||||
|
|
||||||
|
func (c *vndkSnapshotSingleton) MakeVars(ctx android.MakeVarsContext) {
|
||||||
|
// Make uses LLNDK_MOVED_TO_APEX_LIBRARIES to avoid installing libraries on /system if
|
||||||
|
// they been moved to an apex.
|
||||||
|
movedToApexLlndkLibraries := []string{}
|
||||||
|
for _, lib := range c.installedLlndkLibraries {
|
||||||
|
// Skip bionic libs, they are handled in different manner
|
||||||
|
if android.DirectlyInAnyApex(¬OnHostContext{}, lib) && !isBionic(lib) {
|
||||||
|
movedToApexLlndkLibraries = append(movedToApexLlndkLibraries, lib)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctx.Strict("LLNDK_MOVED_TO_APEX_LIBRARIES", strings.Join(movedToApexLlndkLibraries, " "))
|
||||||
|
ctx.Strict("LLNDK_LIBRARIES", strings.Join(c.installedLlndkLibraries, " "))
|
||||||
|
ctx.Strict("VNDK_CORE_LIBRARIES", strings.Join(android.SortedStringKeys(vndkCoreLibraries(ctx.Config())), " "))
|
||||||
|
ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(android.SortedStringKeys(vndkSpLibraries(ctx.Config())), " "))
|
||||||
|
ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(android.SortedStringKeys(vndkPrivateLibraries(ctx.Config())), " "))
|
||||||
|
ctx.Strict("VNDK_USING_CORE_VARIANT_LIBRARIES", strings.Join(android.SortedStringKeys(vndkUsingCoreVariantLibraries(ctx.Config())), " "))
|
||||||
|
|
||||||
|
ctx.Strict("LLNDK_LIBRARIES_FILE", c.llnkdLibrariesFile.String())
|
||||||
|
ctx.Strict("VNDKCORE_LIBRARIES_FILE", c.vndkCoreLibrariesFile.String())
|
||||||
|
ctx.Strict("VNDKSP_LIBRARIES_FILE", c.vndkSpLibrariesFile.String())
|
||||||
|
ctx.Strict("VNDKPRIVATE_LIBRARIES_FILE", c.vndkPrivateLibrariesFile.String())
|
||||||
|
ctx.Strict("VNDKCOREVARIANT_LIBRARIES_FILE", c.vndkCoreVariantLibrariesFile.String())
|
||||||
|
|
||||||
|
ctx.Strict("VNDK_LIBRARIES_FILE", c.vndkLibrariesFile.String())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user