Merge "fix: Override vndk-ext lib name with original lib"

This commit is contained in:
Treehugger Robot 2019-10-24 22:38:00 +00:00 committed by Gerrit Code Review
commit ac1b07e2dc
2 changed files with 31 additions and 1 deletions

View File

@ -768,6 +768,19 @@ func TestVndkExt(t *testing.T) {
}, },
nocrt: true, nocrt: true,
} }
cc_library {
name: "libvndk2",
vendor_available: true,
vndk: {
enabled: true,
},
target: {
vendor: {
suffix: "-suffix",
},
},
nocrt: true,
}
cc_library { cc_library {
name: "libvndk_ext", name: "libvndk_ext",
@ -778,9 +791,22 @@ func TestVndkExt(t *testing.T) {
}, },
nocrt: true, nocrt: true,
} }
cc_library {
name: "libvndk2_ext",
vendor: true,
vndk: {
enabled: true,
extends: "libvndk2",
},
nocrt: true,
}
`) `)
checkVndkModule(t, ctx, "libvndk_ext", "vndk", false, "libvndk") 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) { func TestVndkExtWithoutBoardVndkVersion(t *testing.T) {

View File

@ -599,7 +599,11 @@ func (library *libraryDecorator) getLibName(ctx BaseModuleContext) string {
name += suffix name += suffix
if ctx.isVndkExt() { 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) { if ctx.Host() && Bool(library.Properties.Unique_host_soname) {