Merge "fix: Override vndk-ext lib name with original lib"
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 689aacd..0649c2d 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -768,6 +768,19 @@
},
nocrt: true,
}
+ cc_library {
+ name: "libvndk2",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
+ target: {
+ vendor: {
+ suffix: "-suffix",
+ },
+ },
+ nocrt: true,
+ }
cc_library {
name: "libvndk_ext",
@@ -778,9 +791,22 @@
},
nocrt: true,
}
+
+ cc_library {
+ name: "libvndk2_ext",
+ vendor: true,
+ vndk: {
+ enabled: true,
+ extends: "libvndk2",
+ },
+ nocrt: true,
+ }
`)
checkVndkModule(t, ctx, "libvndk_ext", "vndk", false, "libvndk")
+
+ mod := ctx.ModuleForTests("libvndk2_ext", vendorVariant).Module().(*Module)
+ assertString(t, mod.outputFile.Path().Base(), "libvndk2-suffix.so")
}
func TestVndkExtWithoutBoardVndkVersion(t *testing.T) {
diff --git a/cc/library.go b/cc/library.go
index 80dc76c..829c617 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -599,7 +599,11 @@
name += suffix
if ctx.isVndkExt() {
- name = ctx.getVndkExtendsModuleName()
+ // vndk-ext lib should have the same name with original lib
+ ctx.VisitDirectDepsWithTag(vndkExtDepTag, func(module android.Module) {
+ originalName := module.(*Module).outputFile.Path()
+ name = strings.TrimSuffix(originalName.Base(), originalName.Ext())
+ })
}
if ctx.Host() && Bool(library.Properties.Unique_host_soname) {