Merge "Add LLNDK stubs and headers to VNDK snapshot" am: 266fcfb850 am: 04d916ba64 am: 2ed0d7346e

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1677930

Change-Id: I3143fc53087f14939126db6af6595b3e1282211b
This commit is contained in:
Treehugger Robot 2021-04-17 15:00:59 +00:00 committed by Automerger Merge Worker
commit a211c218df
2 changed files with 40 additions and 7 deletions

View File

@ -546,6 +546,22 @@ func TestVndk(t *testing.T) {
},
}
cc_library {
name: "libllndk",
llndk_stubs: "libllndk.llndk",
}
llndk_library {
name: "libllndk.llndk",
symbol_file: "",
export_llndk_headers: ["libllndk_headers"],
}
llndk_headers {
name: "libllndk_headers",
export_include_dirs: ["include"],
}
llndk_libraries_txt {
name: "llndk.libraries.txt",
}
@ -597,8 +613,11 @@ func TestVndk(t *testing.T) {
vndkCoreLibPath := filepath.Join(vndkLibPath, "shared", "vndk-core")
vndkSpLibPath := filepath.Join(vndkLibPath, "shared", "vndk-sp")
llndkLibPath := filepath.Join(vndkLibPath, "shared", "llndk-stub")
vndkCoreLib2ndPath := filepath.Join(vndkLib2ndPath, "shared", "vndk-core")
vndkSpLib2ndPath := filepath.Join(vndkLib2ndPath, "shared", "vndk-sp")
llndkLib2ndPath := filepath.Join(vndkLib2ndPath, "shared", "llndk-stub")
variant := "android_vendor.29_arm64_armv8-a_shared"
variant2nd := "android_vendor.29_arm_armv7-a-neon_shared"
@ -611,6 +630,8 @@ func TestVndk(t *testing.T) {
checkSnapshot(t, ctx, snapshotSingleton, "libvndk_product", "libvndk_product.so", vndkCoreLib2ndPath, variant2nd)
checkSnapshot(t, ctx, snapshotSingleton, "libvndk_sp", "libvndk_sp-x.so", vndkSpLibPath, variant)
checkSnapshot(t, ctx, snapshotSingleton, "libvndk_sp", "libvndk_sp-x.so", vndkSpLib2ndPath, variant2nd)
checkSnapshot(t, ctx, snapshotSingleton, "libllndk", "libllndk.so", llndkLibPath, variant)
checkSnapshot(t, ctx, snapshotSingleton, "libllndk", "libllndk.so", llndkLib2ndPath, variant2nd)
snapshotConfigsPath := filepath.Join(snapshotVariantPath, "configs")
checkSnapshot(t, ctx, snapshotSingleton, "llndk.libraries.txt", "llndk.libraries.txt", snapshotConfigsPath, "")
@ -623,6 +644,7 @@ func TestVndk(t *testing.T) {
"LLNDK: libc.so",
"LLNDK: libdl.so",
"LLNDK: libft2.so",
"LLNDK: libllndk.so",
"LLNDK: libm.so",
"VNDK-SP: libc++.so",
"VNDK-SP: libvndk_sp-x.so",
@ -639,7 +661,7 @@ func TestVndk(t *testing.T) {
"VNDK-product: libvndk_product.so",
"VNDK-product: libvndk_sp_product_private-x.so",
})
checkVndkLibrariesOutput(t, ctx, "llndk.libraries.txt", []string{"libc.so", "libdl.so", "libft2.so", "libm.so"})
checkVndkLibrariesOutput(t, ctx, "llndk.libraries.txt", []string{"libc.so", "libdl.so", "libft2.so", "libllndk.so", "libm.so"})
checkVndkLibrariesOutput(t, ctx, "vndkcore.libraries.txt", []string{"libvndk-private.so", "libvndk.so", "libvndk_product.so"})
checkVndkLibrariesOutput(t, ctx, "vndksp.libraries.txt", []string{"libc++.so", "libvndk_sp-x.so", "libvndk_sp_private-x.so", "libvndk_sp_product_private-x.so"})
checkVndkLibrariesOutput(t, ctx, "vndkprivate.libraries.txt", []string{"libft2.so", "libvndk-private.so", "libvndk_sp_private-x.so", "libvndk_sp_product_private-x.so"})

View File

@ -609,20 +609,27 @@ func isVndkSnapshotAware(config android.DeviceConfig, m *Module,
}
// !inVendor: There's product/vendor variants for VNDK libs. We only care about vendor variants.
// !installable: Snapshot only cares about "installable" modules.
// !m.IsLlndk: llndk stubs are required for building against snapshots.
// IsSnapshotPrebuilt: Snapshotting a snapshot doesn't make sense.
if !m.InVendor() || !m.installable(apexInfo) || m.IsSnapshotPrebuilt() {
// !outputFile.Valid: Snapshot requires valid output file.
if !m.InVendor() || (!m.installable(apexInfo) && !m.IsLlndk()) || m.IsSnapshotPrebuilt() || !m.outputFile.Valid() {
return nil, "", false
}
l, ok := m.linker.(snapshotLibraryInterface)
if !ok || !l.shared() {
return nil, "", false
}
if m.VndkVersion() == config.PlatformVndkVersion() && m.IsVndk() && !m.IsVndkExt() {
if m.VndkVersion() == config.PlatformVndkVersion() {
if m.IsVndk() && !m.IsVndkExt() {
if m.isVndkSp() {
return l, "vndk-sp", true
} else {
return l, "vndk-core", true
}
} else if l.hasLLNDKStubs() && l.stubsVersion() == "" {
// Use default version for the snapshot.
return l, "llndk-stub", true
}
}
return nil, "", false
@ -652,12 +659,16 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
(VNDK-core libraries, e.g. libbinder.so)
vndk-sp/
(VNDK-SP libraries, e.g. libc++.so)
llndk-stub/
(LLNDK stub libraries)
arch-{TARGET_2ND_ARCH}-{TARGET_2ND_ARCH_VARIANT}/
shared/
vndk-core/
(VNDK-core libraries, e.g. libbinder.so)
vndk-sp/
(VNDK-SP libraries, e.g. libc++.so)
llndk-stub/
(LLNDK stub libraries)
binder32/
(This directory is newly introduced in v28 (Android P) to hold
prebuilts built for 32-bit binder interface.)