Soong generates libraries.txt files for vndk
These files were generated by Make. This is an effort to converting make
to soong.
These files are created under a known location: $SOONG_OUT_DIR/vndk
- llndk.libraries.txt
- vndksp.libraries.txt
- vndkcore.libraries.txt
- vndkprivate.libraries.txt
- vndkcorevariant.libraries.txt
- vndk.libraries.txt: merged all of above with tags
The last one is used by 'check-vndk-list'.
(See the topic)
Others will be packaged by VNDK APEX of current VNDK.
(This is not merged yet. After landing, a follow-up CL will be
followed.)
Bug: 141019581
Bug: 141450808
Test: m check-vndk-list
Change-Id: I9a24f6975bd4b226a94f61a13d43857dcdce6b88
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 689aacd..f13bee5 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -264,6 +264,13 @@
}
}
+func checkVndkOutput(t *testing.T, ctx *android.TestContext, output string, expected []string) {
+ t.Helper()
+ vndkSnapshot := ctx.SingletonForTests("vndk-snapshot")
+ actual := strings.FieldsFunc(strings.ReplaceAll(vndkSnapshot.Output(output).Args["content"], "\\n", "\n"), func(r rune) bool { return r == '\n' })
+ assertArrayString(t, actual, expected)
+}
+
func TestVndk(t *testing.T) {
config := android.TestArchConfig(buildDir, nil)
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
@@ -336,6 +343,69 @@
checkVndkSnapshot(t, ctx, "libvndk", vndkCoreLib2ndPath, variant2nd)
checkVndkSnapshot(t, ctx, "libvndk_sp", vndkSpLibPath, variant)
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/vndkcorevariant.libraries.txt", nil)
+ // merged & tagged & filtered-out(libclang_rt)
+ 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-SP: libvndk_sp.so",
+ "VNDK-SP: libvndk_sp_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",
+ })
+}
+
+func TestVndkUsingCoreVariant(t *testing.T) {
+ config := android.TestArchConfig(buildDir, nil)
+ config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
+ config.TestProductVariables.Platform_vndk_version = StringPtr("VER")
+ config.TestProductVariables.VndkUseCoreVariant = BoolPtr(true)
+
+ setVndkMustUseVendorVariantListForTest(config, []string{"libvndk"})
+
+ ctx := testCcWithConfig(t, `
+ cc_library {
+ name: "libvndk",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
+ nocrt: true,
+ }
+
+ cc_library {
+ name: "libvndk_sp",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ support_system_process: true,
+ },
+ nocrt: true,
+ }
+
+ cc_library {
+ name: "libvndk2",
+ vendor_available: false,
+ vndk: {
+ enabled: true,
+ },
+ nocrt: true,
+ }
+ `, config)
+
+ checkVndkOutput(t, ctx, "vndk/vndkcore.libraries.txt", []string{"libvndk.so", "libvndk2.so"})
+ checkVndkOutput(t, ctx, "vndk/vndkcorevariant.libraries.txt", []string{"libvndk2.so"})
}
func TestVndkDepError(t *testing.T) {
@@ -1340,9 +1410,9 @@
assertArrayString(t, *vndkSpLibraries(config),
[]string{"libc++", "libvndksp"})
assertArrayString(t, *llndkLibraries(config),
- []string{"libc", "libdl", "libllndk", "libllndkprivate", "libm"})
+ []string{"libc", "libdl", "libft2", "libllndk", "libllndkprivate", "libm"})
assertArrayString(t, *vndkPrivateLibraries(config),
- []string{"libllndkprivate", "libvndkprivate"})
+ []string{"libft2", "libllndkprivate", "libvndkprivate"})
vendorVariant27 := "android_arm64_armv8-a_vendor.27_shared"