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
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 064b1a2..808968c 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -293,6 +293,7 @@
enabled: true,
},
nocrt: true,
+ stem: "libvndk-private",
}
cc_library {
@@ -303,6 +304,7 @@
support_system_process: true,
},
nocrt: true,
+ suffix: "-x",
}
cc_library {
@@ -313,6 +315,11 @@
support_system_process: true,
},
nocrt: true,
+ target: {
+ vendor: {
+ suffix: "-x",
+ },
+ },
}
`, config)
@@ -345,9 +352,9 @@
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/vndkcore.libraries.txt", []string{"libvndk.so", "libvndk_private.so"})
- checkVndkOutput(t, ctx, "vndk/vndkprivate.libraries.txt", []string{"libft2.so", "libvndk_private.so", "libvndk_sp_private.so"})
- checkVndkOutput(t, ctx, "vndk/vndksp.libraries.txt", []string{"libc++.so", "libvndk_sp.so", "libvndk_sp_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-x.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)
// merged & tagged & filtered-out(libclang_rt)
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
@@ -356,14 +363,27 @@
"LLNDK: libft2.so",
"LLNDK: libm.so",
"VNDK-SP: libc++.so",
- "VNDK-SP: libvndk_sp.so",
- "VNDK-SP: libvndk_sp_private.so",
+ "VNDK-SP: libvndk_sp-x.so",
+ "VNDK-SP: libvndk_sp_private-x.so",
+ "VNDK-core: libvndk-private.so",
"VNDK-core: libvndk.so",
- "VNDK-core: libvndk_private.so",
"VNDK-private: libft2.so",
- "VNDK-private: libvndk_private.so",
- "VNDK-private: libvndk_sp_private.so",
+ "VNDK-private: libvndk-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) {
@@ -405,7 +425,36 @@
`, config)
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) {
@@ -1431,13 +1480,13 @@
symbol_file: "",
}`, config)
- assertArrayString(t, *vndkCoreLibraries(config),
+ assertMapKeys(t, vndkCoreLibraries(config),
[]string{"libvndk", "libvndkprivate"})
- assertArrayString(t, *vndkSpLibraries(config),
+ assertMapKeys(t, vndkSpLibraries(config),
[]string{"libc++", "libvndksp"})
- assertArrayString(t, *llndkLibraries(config),
+ assertMapKeys(t, llndkLibraries(config),
[]string{"libc", "libdl", "libft2", "libllndk", "libllndkprivate", "libm"})
- assertArrayString(t, *vndkPrivateLibraries(config),
+ assertMapKeys(t, vndkPrivateLibraries(config),
[]string{"libft2", "libllndkprivate", "libvndkprivate"})
vendorVariant27 := "android_arm64_armv8-a_vendor.27_shared"
@@ -2419,6 +2468,11 @@
}
}
+func assertMapKeys(t *testing.T, m map[string]string, expected []string) {
+ t.Helper()
+ assertArrayString(t, android.SortedStringKeys(m), expected)
+}
+
func TestDefaults(t *testing.T) {
ctx := testCc(t, `
cc_defaults {