Add suffix and target.vendor.suffix to shared libraries

And make prebuilt shared libraries suffix and stem too.

This will be used for the vendor version of the protobuf
runtime shared libraries to append the protobuf version
number to the installed file name, which will help with
updating protobuf in the future.

Bug: 117607748
Test: m checkbuild
Change-Id: I8919a4f2e1be1ced29198af758077baf56c1f7a7
Merged-In: I8919a4f2e1be1ced29198af758077baf56c1f7a7
This commit is contained in:
Colin Cross 2019-08-16 14:22:10 -07:00
parent 6ac046000f
commit 0fd6a41a6d
2 changed files with 22 additions and 2 deletions

View File

@ -88,6 +88,16 @@ type LibraryProperties struct {
// set the name of the output
Stem *string `android:"arch_variant"`
// set suffix of the name of the output
Suffix *string `android:"arch_variant"`
Target struct {
Vendor struct {
// set suffix of the name of the output
Suffix *string `android:"arch_variant"`
}
}
// Names of modules to be overridden. Listed modules can only be other shared libraries
// (in Make or Soong).
// This does not completely prevent installation of the overridden libraries, but if both
@ -549,7 +559,7 @@ type libraryInterface interface {
androidMkWriteAdditionalDependenciesForSourceAbiDiff(w io.Writer)
}
func (library *libraryDecorator) getLibName(ctx ModuleContext) string {
func (library *libraryDecorator) getLibName(ctx BaseModuleContext) string {
name := library.libName
if name == "" {
name = String(library.Properties.Stem)
@ -558,6 +568,16 @@ func (library *libraryDecorator) getLibName(ctx ModuleContext) string {
}
}
suffix := ""
if ctx.useVndk() {
suffix = String(library.Properties.Target.Vendor.Suffix)
}
if suffix == "" {
suffix = String(library.Properties.Suffix)
}
name += suffix
if ctx.isVndkExt() {
name = ctx.getVndkExtendsModuleName()
}

View File

@ -97,7 +97,7 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
if p.shared() {
p.unstrippedOutputFile = in
libName := ctx.baseModuleName() + flags.Toolchain.ShlibSuffix()
libName := p.libraryDecorator.getLibName(ctx) + flags.Toolchain.ShlibSuffix()
if p.needsStrip(ctx) {
stripped := android.PathForModuleOut(ctx, "stripped", libName)
p.stripExecutableOrSharedLib(ctx, in, stripped, builderFlags)