Merge "rust: Don't append '.vendor' to vendor modules." am: dc46c6dcbb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2062447 Change-Id: Ibd9bf52d6d76f06fbb14213a083d7e31880772eb Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
f6cd4e10dc
3 changed files with 49 additions and 35 deletions
47
cc/cc.go
47
cc/cc.go
|
@ -1218,6 +1218,17 @@ func (c *Module) IsVendorPublicLibrary() bool {
|
||||||
return c.VendorProperties.IsVendorPublicLibrary
|
return c.VendorProperties.IsVendorPublicLibrary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Module) IsVndkPrebuiltLibrary() bool {
|
||||||
|
if _, ok := c.linker.(*vndkPrebuiltLibraryDecorator); ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Module) SdkAndPlatformVariantVisibleToMake() bool {
|
||||||
|
return c.Properties.SdkAndPlatformVariantVisibleToMake
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Module) HasLlndkStubs() bool {
|
func (c *Module) HasLlndkStubs() bool {
|
||||||
lib := moduleLibraryInterface(c)
|
lib := moduleLibraryInterface(c)
|
||||||
return lib != nil && lib.hasLLNDKStubs()
|
return lib != nil && lib.hasLLNDKStubs()
|
||||||
|
@ -1699,7 +1710,7 @@ func (c *Module) DataPaths() []android.DataPath {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) getNameSuffixWithVndkVersion(ctx android.ModuleContext) string {
|
func getNameSuffixWithVndkVersion(ctx android.ModuleContext, c LinkableInterface) string {
|
||||||
// Returns the name suffix for product and vendor variants. If the VNDK version is not
|
// Returns the name suffix for product and vendor variants. If the VNDK version is not
|
||||||
// "current", it will append the VNDK version to the name suffix.
|
// "current", it will append the VNDK version to the name suffix.
|
||||||
var vndkVersion string
|
var vndkVersion string
|
||||||
|
@ -1719,19 +1730,19 @@ func (c *Module) getNameSuffixWithVndkVersion(ctx android.ModuleContext) string
|
||||||
if vndkVersion == "current" {
|
if vndkVersion == "current" {
|
||||||
vndkVersion = ctx.DeviceConfig().PlatformVndkVersion()
|
vndkVersion = ctx.DeviceConfig().PlatformVndkVersion()
|
||||||
}
|
}
|
||||||
if c.Properties.VndkVersion != vndkVersion && c.Properties.VndkVersion != "" {
|
if c.VndkVersion() != vndkVersion && c.VndkVersion() != "" {
|
||||||
// add version suffix only if the module is using different vndk version than the
|
// add version suffix only if the module is using different vndk version than the
|
||||||
// version in product or vendor partition.
|
// version in product or vendor partition.
|
||||||
nameSuffix += "." + c.Properties.VndkVersion
|
nameSuffix += "." + c.VndkVersion()
|
||||||
}
|
}
|
||||||
return nameSuffix
|
return nameSuffix
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) setSubnameProperty(actx android.ModuleContext) {
|
func GetSubnameProperty(actx android.ModuleContext, c LinkableInterface) string {
|
||||||
c.Properties.SubName = ""
|
var subName = ""
|
||||||
|
|
||||||
if c.Target().NativeBridge == android.NativeBridgeEnabled {
|
if c.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||||
c.Properties.SubName += NativeBridgeSuffix
|
subName += NativeBridgeSuffix
|
||||||
}
|
}
|
||||||
|
|
||||||
llndk := c.IsLlndk()
|
llndk := c.IsLlndk()
|
||||||
|
@ -1739,25 +1750,27 @@ func (c *Module) setSubnameProperty(actx android.ModuleContext) {
|
||||||
// .vendor.{version} suffix is added for vendor variant or .product.{version} suffix is
|
// .vendor.{version} suffix is added for vendor variant or .product.{version} suffix is
|
||||||
// added for product variant only when we have vendor and product variants with core
|
// added for product variant only when we have vendor and product variants with core
|
||||||
// variant. The suffix is not added for vendor-only or product-only module.
|
// variant. The suffix is not added for vendor-only or product-only module.
|
||||||
c.Properties.SubName += c.getNameSuffixWithVndkVersion(actx)
|
subName += getNameSuffixWithVndkVersion(actx, c)
|
||||||
} else if c.IsVendorPublicLibrary() {
|
} else if c.IsVendorPublicLibrary() {
|
||||||
c.Properties.SubName += vendorPublicLibrarySuffix
|
subName += vendorPublicLibrarySuffix
|
||||||
} else if _, ok := c.linker.(*vndkPrebuiltLibraryDecorator); ok {
|
} else if c.IsVndkPrebuiltLibrary() {
|
||||||
// .vendor suffix is added for backward compatibility with VNDK snapshot whose names with
|
// .vendor suffix is added for backward compatibility with VNDK snapshot whose names with
|
||||||
// such suffixes are already hard-coded in prebuilts/vndk/.../Android.bp.
|
// such suffixes are already hard-coded in prebuilts/vndk/.../Android.bp.
|
||||||
c.Properties.SubName += VendorSuffix
|
subName += VendorSuffix
|
||||||
} else if c.InRamdisk() && !c.OnlyInRamdisk() {
|
} else if c.InRamdisk() && !c.OnlyInRamdisk() {
|
||||||
c.Properties.SubName += RamdiskSuffix
|
subName += RamdiskSuffix
|
||||||
} else if c.InVendorRamdisk() && !c.OnlyInVendorRamdisk() {
|
} else if c.InVendorRamdisk() && !c.OnlyInVendorRamdisk() {
|
||||||
c.Properties.SubName += VendorRamdiskSuffix
|
subName += VendorRamdiskSuffix
|
||||||
} else if c.InRecovery() && !c.OnlyInRecovery() {
|
} else if c.InRecovery() && !c.OnlyInRecovery() {
|
||||||
c.Properties.SubName += RecoverySuffix
|
subName += RecoverySuffix
|
||||||
} else if c.IsSdkVariant() && (c.Properties.SdkAndPlatformVariantVisibleToMake || c.SplitPerApiLevel()) {
|
} else if c.IsSdkVariant() && (c.SdkAndPlatformVariantVisibleToMake() || c.SplitPerApiLevel()) {
|
||||||
c.Properties.SubName += sdkSuffix
|
subName += sdkSuffix
|
||||||
if c.SplitPerApiLevel() {
|
if c.SplitPerApiLevel() {
|
||||||
c.Properties.SubName += "." + c.SdkVersion()
|
subName += "." + c.SdkVersion()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return subName
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if Bazel was successfully used for the analysis of this module.
|
// Returns true if Bazel was successfully used for the analysis of this module.
|
||||||
|
@ -1795,7 +1808,7 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.setSubnameProperty(actx)
|
c.Properties.SubName = GetSubnameProperty(actx, c)
|
||||||
apexInfo := actx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
apexInfo := actx.Provider(android.ApexInfoProvider).(android.ApexInfo)
|
||||||
if !apexInfo.IsForPlatform() {
|
if !apexInfo.IsForPlatform() {
|
||||||
c.hideApexVariantFromMake = true
|
c.hideApexVariantFromMake = true
|
||||||
|
|
|
@ -176,10 +176,14 @@ type LinkableInterface interface {
|
||||||
IsVndk() bool
|
IsVndk() bool
|
||||||
IsVndkExt() bool
|
IsVndkExt() bool
|
||||||
IsVndkPrivate() bool
|
IsVndkPrivate() bool
|
||||||
|
IsVendorPublicLibrary() bool
|
||||||
|
IsVndkPrebuiltLibrary() bool
|
||||||
HasVendorVariant() bool
|
HasVendorVariant() bool
|
||||||
HasProductVariant() bool
|
HasProductVariant() bool
|
||||||
HasNonSystemVariants() bool
|
HasNonSystemVariants() bool
|
||||||
|
ProductSpecific() bool
|
||||||
InProduct() bool
|
InProduct() bool
|
||||||
|
SdkAndPlatformVariantVisibleToMake() bool
|
||||||
|
|
||||||
// SubName returns the modules SubName, used for image and NDK/SDK variations.
|
// SubName returns the modules SubName, used for image and NDK/SDK variations.
|
||||||
SubName() string
|
SubName() string
|
||||||
|
|
33
rust/rust.go
33
rust/rust.go
|
@ -332,6 +332,20 @@ func (mod *Module) IsVndkSp() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mod *Module) IsVndkPrebuiltLibrary() bool {
|
||||||
|
// Rust modules do not provide VNDK prebuilts
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *Module) IsVendorPublicLibrary() bool {
|
||||||
|
return mod.VendorProperties.IsVendorPublicLibrary
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *Module) SdkAndPlatformVariantVisibleToMake() bool {
|
||||||
|
// Rust modules to not provide Sdk variants
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Module) IsVndkPrivate() bool {
|
func (c *Module) IsVndkPrivate() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -841,24 +855,7 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
||||||
toolchain := mod.toolchain(ctx)
|
toolchain := mod.toolchain(ctx)
|
||||||
mod.makeLinkType = cc.GetMakeLinkType(actx, mod)
|
mod.makeLinkType = cc.GetMakeLinkType(actx, mod)
|
||||||
|
|
||||||
// Differentiate static libraries that are vendor available
|
mod.Properties.SubName = cc.GetSubnameProperty(actx, mod)
|
||||||
if mod.UseVndk() {
|
|
||||||
if mod.InProduct() && !mod.OnlyInProduct() {
|
|
||||||
mod.Properties.SubName += cc.ProductSuffix
|
|
||||||
} else {
|
|
||||||
mod.Properties.SubName += cc.VendorSuffix
|
|
||||||
}
|
|
||||||
} else if mod.InRamdisk() && !mod.OnlyInRamdisk() {
|
|
||||||
mod.Properties.SubName += cc.RamdiskSuffix
|
|
||||||
} else if mod.InVendorRamdisk() && !mod.OnlyInVendorRamdisk() {
|
|
||||||
mod.Properties.SubName += cc.VendorRamdiskSuffix
|
|
||||||
} else if mod.InRecovery() && !mod.OnlyInRecovery() {
|
|
||||||
mod.Properties.SubName += cc.RecoverySuffix
|
|
||||||
}
|
|
||||||
|
|
||||||
if mod.Target().NativeBridge == android.NativeBridgeEnabled {
|
|
||||||
mod.Properties.SubName += cc.NativeBridgeSuffix
|
|
||||||
}
|
|
||||||
|
|
||||||
if !toolchain.Supported() {
|
if !toolchain.Supported() {
|
||||||
// This toolchain's unsupported, there's nothing to do for this mod.
|
// This toolchain's unsupported, there's nothing to do for this mod.
|
||||||
|
|
Loading…
Reference in a new issue