Loading apex/vndk.go +4 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,10 @@ func apexVndkMutator(mctx android.TopDownMutatorContext) { func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) { if m, ok := mctx.Module().(*cc.Module); ok && cc.IsForVndkApex(mctx, m) { vndkVersion := m.VndkVersion() // For VNDK-Lite device, we gather core-variants of VNDK-Sp libraries, which doesn't have VNDK version defined if vndkVersion == "" { vndkVersion = mctx.DeviceConfig().PlatformVndkVersion() } vndkApexList := vndkApexList(mctx.Config()) if vndkApex, ok := vndkApexList[vndkVersion]; ok { mctx.AddReverseDependency(mctx.Module(), sharedLibTag, vndkApex) Loading apex/vndk_test.go +53 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,59 @@ import ( "android/soong/android" ) func TestVndkApexForVndkLite(t *testing.T) { ctx, _ := testApex(t, ` apex_vndk { name: "myapex", key: "myapex.key", } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "libvndk", srcs: ["mylib.cpp"], vendor_available: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", apex_available: [ "myapex" ], } cc_library { name: "libvndksp", srcs: ["mylib.cpp"], vendor_available: true, vndk: { enabled: true, support_system_process: true, }, system_shared_libs: [], stl: "none", apex_available: [ "myapex" ], } `+vndkLibrariesTxtFiles("current"), func(fs map[string][]byte, config android.Config) { config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("") }) // VNDK-Lite contains only core variants of VNDK-Sp libraries ensureExactContents(t, ctx, "myapex", "android_common_image", []string{ "lib/libvndksp.so", "lib/libc++.so", "lib64/libvndksp.so", "lib64/libc++.so", "etc/llndk.libraries.VER.txt", "etc/vndkcore.libraries.VER.txt", "etc/vndksp.libraries.VER.txt", "etc/vndkprivate.libraries.VER.txt", }) } func TestVndkApexUsesVendorVariant(t *testing.T) { bp := ` apex_vndk { Loading cc/vndk.go +9 −0 Original line number Diff line number Diff line Loading @@ -350,6 +350,15 @@ func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool { } if lib, ok := m.linker.(libraryInterface); ok { // VNDK APEX for VNDK-Lite devices will have VNDK-SP libraries from core variants if mctx.DeviceConfig().VndkVersion() == "" { // b/73296261: filter out libz.so because it is considered as LLNDK for VNDK-lite devices if mctx.ModuleName() == "libz" { return false } return m.ImageVariation().Variation == android.CoreVariation && lib.shared() && m.isVndkSp() } useCoreVariant := m.VndkVersion() == mctx.DeviceConfig().PlatformVndkVersion() && mctx.DeviceConfig().VndkUseCoreVariant() && !m.MustUseVendorVariant() return lib.shared() && m.inVendor() && m.IsVndk() && !m.isVndkExt() && !useCoreVariant Loading Loading
apex/vndk.go +4 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,10 @@ func apexVndkMutator(mctx android.TopDownMutatorContext) { func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) { if m, ok := mctx.Module().(*cc.Module); ok && cc.IsForVndkApex(mctx, m) { vndkVersion := m.VndkVersion() // For VNDK-Lite device, we gather core-variants of VNDK-Sp libraries, which doesn't have VNDK version defined if vndkVersion == "" { vndkVersion = mctx.DeviceConfig().PlatformVndkVersion() } vndkApexList := vndkApexList(mctx.Config()) if vndkApex, ok := vndkApexList[vndkVersion]; ok { mctx.AddReverseDependency(mctx.Module(), sharedLibTag, vndkApex) Loading
apex/vndk_test.go +53 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,59 @@ import ( "android/soong/android" ) func TestVndkApexForVndkLite(t *testing.T) { ctx, _ := testApex(t, ` apex_vndk { name: "myapex", key: "myapex.key", } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "libvndk", srcs: ["mylib.cpp"], vendor_available: true, vndk: { enabled: true, }, system_shared_libs: [], stl: "none", apex_available: [ "myapex" ], } cc_library { name: "libvndksp", srcs: ["mylib.cpp"], vendor_available: true, vndk: { enabled: true, support_system_process: true, }, system_shared_libs: [], stl: "none", apex_available: [ "myapex" ], } `+vndkLibrariesTxtFiles("current"), func(fs map[string][]byte, config android.Config) { config.TestProductVariables.DeviceVndkVersion = proptools.StringPtr("") }) // VNDK-Lite contains only core variants of VNDK-Sp libraries ensureExactContents(t, ctx, "myapex", "android_common_image", []string{ "lib/libvndksp.so", "lib/libc++.so", "lib64/libvndksp.so", "lib64/libc++.so", "etc/llndk.libraries.VER.txt", "etc/vndkcore.libraries.VER.txt", "etc/vndksp.libraries.VER.txt", "etc/vndkprivate.libraries.VER.txt", }) } func TestVndkApexUsesVendorVariant(t *testing.T) { bp := ` apex_vndk { Loading
cc/vndk.go +9 −0 Original line number Diff line number Diff line Loading @@ -350,6 +350,15 @@ func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool { } if lib, ok := m.linker.(libraryInterface); ok { // VNDK APEX for VNDK-Lite devices will have VNDK-SP libraries from core variants if mctx.DeviceConfig().VndkVersion() == "" { // b/73296261: filter out libz.so because it is considered as LLNDK for VNDK-lite devices if mctx.ModuleName() == "libz" { return false } return m.ImageVariation().Variation == android.CoreVariation && lib.shared() && m.isVndkSp() } useCoreVariant := m.VndkVersion() == mctx.DeviceConfig().PlatformVndkVersion() && mctx.DeviceConfig().VndkUseCoreVariant() && !m.MustUseVendorVariant() return lib.shared() && m.inVendor() && m.IsVndk() && !m.isVndkExt() && !useCoreVariant Loading