Merge changes I904b4374,I6b4ea062
* changes: Do not add '.product' suffix for product_specific module Use target dependent module to update the name suffix
This commit is contained in:
21
cc/cc.go
21
cc/cc.go
@@ -1535,6 +1535,11 @@ func (c *Module) getNameSuffixWithVndkVersion(ctx android.ModuleContext) string
|
|||||||
var vndkVersion string
|
var vndkVersion string
|
||||||
var nameSuffix string
|
var nameSuffix string
|
||||||
if c.InProduct() {
|
if c.InProduct() {
|
||||||
|
if c.ProductSpecific() {
|
||||||
|
// If the module is product specific with 'product_specific: true',
|
||||||
|
// do not add a name suffix because it is a base module.
|
||||||
|
return ""
|
||||||
|
}
|
||||||
vndkVersion = ctx.DeviceConfig().ProductVndkVersion()
|
vndkVersion = ctx.DeviceConfig().ProductVndkVersion()
|
||||||
nameSuffix = productSuffix
|
nameSuffix = productSuffix
|
||||||
} else {
|
} else {
|
||||||
@@ -2891,12 +2896,12 @@ func (c *Module) makeLibName(ctx android.ModuleContext, ccDep LinkableInterface,
|
|||||||
ccDepModule, _ := ccDep.(*Module)
|
ccDepModule, _ := ccDep.(*Module)
|
||||||
isLLndk := ccDepModule != nil && ccDepModule.IsLlndk()
|
isLLndk := ccDepModule != nil && ccDepModule.IsLlndk()
|
||||||
isVendorPublicLib := inList(libName, *vendorPublicLibraries)
|
isVendorPublicLib := inList(libName, *vendorPublicLibraries)
|
||||||
bothVendorAndCoreVariantsExist := ccDep.HasVendorVariant() || isLLndk
|
nonSystemVariantsExist := ccDep.HasNonSystemVariants() || isLLndk
|
||||||
|
|
||||||
if c, ok := ccDep.(*Module); ok {
|
if ccDepModule != nil {
|
||||||
// Use base module name for snapshots when exporting to Makefile.
|
// Use base module name for snapshots when exporting to Makefile.
|
||||||
if snapshotPrebuilt, ok := c.linker.(snapshotInterface); ok {
|
if snapshotPrebuilt, ok := ccDepModule.linker.(snapshotInterface); ok {
|
||||||
baseName := c.BaseModuleName()
|
baseName := ccDepModule.BaseModuleName()
|
||||||
|
|
||||||
return baseName + snapshotPrebuilt.snapshotAndroidMkSuffix()
|
return baseName + snapshotPrebuilt.snapshotAndroidMkSuffix()
|
||||||
}
|
}
|
||||||
@@ -2907,10 +2912,10 @@ func (c *Module) makeLibName(ctx android.ModuleContext, ccDep LinkableInterface,
|
|||||||
// The vendor module is a no-vendor-variant VNDK library. Depend on the
|
// The vendor module is a no-vendor-variant VNDK library. Depend on the
|
||||||
// core module instead.
|
// core module instead.
|
||||||
return libName
|
return libName
|
||||||
} else if c.UseVndk() && bothVendorAndCoreVariantsExist {
|
} else if ccDep.UseVndk() && nonSystemVariantsExist && ccDepModule != nil {
|
||||||
// The vendor module in Make will have been renamed to not conflict with the core
|
// The vendor and product modules in Make will have been renamed to not conflict with the
|
||||||
// module, so update the dependency name here accordingly.
|
// core module, so update the dependency name here accordingly.
|
||||||
return libName + c.getNameSuffixWithVndkVersion(ctx)
|
return libName + ccDepModule.Properties.SubName
|
||||||
} else if (ctx.Platform() || ctx.ProductSpecific()) && isVendorPublicLib {
|
} else if (ctx.Platform() || ctx.ProductSpecific()) && isVendorPublicLib {
|
||||||
return libName + vendorPublicLibrarySuffix
|
return libName + vendorPublicLibrarySuffix
|
||||||
} else if ccDep.InRamdisk() && !ccDep.OnlyInRamdisk() {
|
} else if ccDep.InRamdisk() && !ccDep.OnlyInRamdisk() {
|
||||||
|
@@ -2711,6 +2711,14 @@ const runtimeLibAndroidBp = `
|
|||||||
nocrt : true,
|
nocrt : true,
|
||||||
system_shared_libs : [],
|
system_shared_libs : [],
|
||||||
}
|
}
|
||||||
|
cc_library {
|
||||||
|
name: "libproduct_vendor",
|
||||||
|
product_specific: true,
|
||||||
|
vendor_available: true,
|
||||||
|
no_libcrt : true,
|
||||||
|
nocrt : true,
|
||||||
|
system_shared_libs : [],
|
||||||
|
}
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libcore",
|
name: "libcore",
|
||||||
runtime_libs: ["liball_available"],
|
runtime_libs: ["liball_available"],
|
||||||
@@ -2728,7 +2736,7 @@ const runtimeLibAndroidBp = `
|
|||||||
cc_library {
|
cc_library {
|
||||||
name: "libvendor2",
|
name: "libvendor2",
|
||||||
vendor: true,
|
vendor: true,
|
||||||
runtime_libs: ["liball_available", "libvendor1"],
|
runtime_libs: ["liball_available", "libvendor1", "libproduct_vendor"],
|
||||||
no_libcrt : true,
|
no_libcrt : true,
|
||||||
nocrt : true,
|
nocrt : true,
|
||||||
system_shared_libs : [],
|
system_shared_libs : [],
|
||||||
@@ -2751,7 +2759,7 @@ const runtimeLibAndroidBp = `
|
|||||||
cc_library {
|
cc_library {
|
||||||
name: "libproduct2",
|
name: "libproduct2",
|
||||||
product_specific: true,
|
product_specific: true,
|
||||||
runtime_libs: ["liball_available", "libproduct1"],
|
runtime_libs: ["liball_available", "libproduct1", "libproduct_vendor"],
|
||||||
no_libcrt : true,
|
no_libcrt : true,
|
||||||
nocrt : true,
|
nocrt : true,
|
||||||
system_shared_libs : [],
|
system_shared_libs : [],
|
||||||
@@ -2781,7 +2789,7 @@ func TestRuntimeLibs(t *testing.T) {
|
|||||||
checkRuntimeLibs(t, []string{"liball_available.vendor"}, module)
|
checkRuntimeLibs(t, []string{"liball_available.vendor"}, module)
|
||||||
|
|
||||||
module = ctx.ModuleForTests("libvendor2", variant).Module().(*Module)
|
module = ctx.ModuleForTests("libvendor2", variant).Module().(*Module)
|
||||||
checkRuntimeLibs(t, []string{"liball_available.vendor", "libvendor1"}, module)
|
checkRuntimeLibs(t, []string{"liball_available.vendor", "libvendor1", "libproduct_vendor.vendor"}, module)
|
||||||
|
|
||||||
// runtime_libs for product variants have '.product' suffixes if the modules have both core
|
// runtime_libs for product variants have '.product' suffixes if the modules have both core
|
||||||
// and product variants.
|
// and product variants.
|
||||||
@@ -2791,7 +2799,7 @@ func TestRuntimeLibs(t *testing.T) {
|
|||||||
checkRuntimeLibs(t, []string{"liball_available.product"}, module)
|
checkRuntimeLibs(t, []string{"liball_available.product"}, module)
|
||||||
|
|
||||||
module = ctx.ModuleForTests("libproduct2", variant).Module().(*Module)
|
module = ctx.ModuleForTests("libproduct2", variant).Module().(*Module)
|
||||||
checkRuntimeLibs(t, []string{"liball_available.product", "libproduct1"}, module)
|
checkRuntimeLibs(t, []string{"liball_available.product", "libproduct1", "libproduct_vendor"}, module)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExcludeRuntimeLibs(t *testing.T) {
|
func TestExcludeRuntimeLibs(t *testing.T) {
|
||||||
@@ -2817,10 +2825,10 @@ func TestRuntimeLibsNoVndk(t *testing.T) {
|
|||||||
checkRuntimeLibs(t, []string{"liball_available"}, module)
|
checkRuntimeLibs(t, []string{"liball_available"}, module)
|
||||||
|
|
||||||
module = ctx.ModuleForTests("libvendor2", variant).Module().(*Module)
|
module = ctx.ModuleForTests("libvendor2", variant).Module().(*Module)
|
||||||
checkRuntimeLibs(t, []string{"liball_available", "libvendor1"}, module)
|
checkRuntimeLibs(t, []string{"liball_available", "libvendor1", "libproduct_vendor"}, module)
|
||||||
|
|
||||||
module = ctx.ModuleForTests("libproduct2", variant).Module().(*Module)
|
module = ctx.ModuleForTests("libproduct2", variant).Module().(*Module)
|
||||||
checkRuntimeLibs(t, []string{"liball_available", "libproduct1"}, module)
|
checkRuntimeLibs(t, []string{"liball_available", "libproduct1", "libproduct_vendor"}, module)
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkStaticLibs(t *testing.T, expected []string, module *Module) {
|
func checkStaticLibs(t *testing.T, expected []string, module *Module) {
|
||||||
|
@@ -106,6 +106,8 @@ type LinkableInterface interface {
|
|||||||
IsVndkExt() bool
|
IsVndkExt() bool
|
||||||
IsVndkPrivate() bool
|
IsVndkPrivate() bool
|
||||||
HasVendorVariant() bool
|
HasVendorVariant() bool
|
||||||
|
HasProductVariant() bool
|
||||||
|
HasNonSystemVariants() bool
|
||||||
InProduct() bool
|
InProduct() bool
|
||||||
|
|
||||||
SdkVersion() string
|
SdkVersion() string
|
||||||
|
@@ -71,6 +71,15 @@ func (mod *Module) HasVendorVariant() bool {
|
|||||||
return Bool(mod.VendorProperties.Vendor_available) || Bool(mod.VendorProperties.Odm_available)
|
return Bool(mod.VendorProperties.Vendor_available) || Bool(mod.VendorProperties.Odm_available)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always returns false because rust modules do not support product variant.
|
||||||
|
func (mod *Module) HasProductVariant() bool {
|
||||||
|
return Bool(mod.VendorProperties.Product_available)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *Module) HasNonSystemVariants() bool {
|
||||||
|
return mod.HasVendorVariant() || mod.HasProductVariant()
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Module) InProduct() bool {
|
func (c *Module) InProduct() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user