Loading cc/cc.go +30 −17 Original line number Diff line number Diff line Loading @@ -1218,6 +1218,17 @@ func (c *Module) IsVendorPublicLibrary() bool { 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 { lib := moduleLibraryInterface(c) return lib != nil && lib.hasLLNDKStubs() Loading Loading @@ -1699,7 +1710,7 @@ func (c *Module) DataPaths() []android.DataPath { 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 // "current", it will append the VNDK version to the name suffix. var vndkVersion string Loading @@ -1719,19 +1730,19 @@ func (c *Module) getNameSuffixWithVndkVersion(ctx android.ModuleContext) string if vndkVersion == "current" { 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 // version in product or vendor partition. nameSuffix += "." + c.Properties.VndkVersion nameSuffix += "." + c.VndkVersion() } return nameSuffix } func (c *Module) setSubnameProperty(actx android.ModuleContext) { c.Properties.SubName = "" func GetSubnameProperty(actx android.ModuleContext, c LinkableInterface) string { var subName = "" if c.Target().NativeBridge == android.NativeBridgeEnabled { c.Properties.SubName += NativeBridgeSuffix subName += NativeBridgeSuffix } llndk := c.IsLlndk() Loading @@ -1739,25 +1750,27 @@ func (c *Module) setSubnameProperty(actx android.ModuleContext) { // .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 // 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() { c.Properties.SubName += vendorPublicLibrarySuffix } else if _, ok := c.linker.(*vndkPrebuiltLibraryDecorator); ok { subName += vendorPublicLibrarySuffix } else if c.IsVndkPrebuiltLibrary() { // .vendor suffix is added for backward compatibility with VNDK snapshot whose names with // such suffixes are already hard-coded in prebuilts/vndk/.../Android.bp. c.Properties.SubName += VendorSuffix subName += VendorSuffix } else if c.InRamdisk() && !c.OnlyInRamdisk() { c.Properties.SubName += RamdiskSuffix subName += RamdiskSuffix } else if c.InVendorRamdisk() && !c.OnlyInVendorRamdisk() { c.Properties.SubName += VendorRamdiskSuffix subName += VendorRamdiskSuffix } else if c.InRecovery() && !c.OnlyInRecovery() { c.Properties.SubName += RecoverySuffix } else if c.IsSdkVariant() && (c.Properties.SdkAndPlatformVariantVisibleToMake || c.SplitPerApiLevel()) { c.Properties.SubName += sdkSuffix subName += RecoverySuffix } else if c.IsSdkVariant() && (c.SdkAndPlatformVariantVisibleToMake() || c.SplitPerApiLevel()) { subName += sdkSuffix 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. Loading Loading @@ -1795,7 +1808,7 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { return } c.setSubnameProperty(actx) c.Properties.SubName = GetSubnameProperty(actx, c) apexInfo := actx.Provider(android.ApexInfoProvider).(android.ApexInfo) if !apexInfo.IsForPlatform() { c.hideApexVariantFromMake = true Loading cc/linkable.go +4 −0 Original line number Diff line number Diff line Loading @@ -176,10 +176,14 @@ type LinkableInterface interface { IsVndk() bool IsVndkExt() bool IsVndkPrivate() bool IsVendorPublicLibrary() bool IsVndkPrebuiltLibrary() bool HasVendorVariant() bool HasProductVariant() bool HasNonSystemVariants() bool ProductSpecific() bool InProduct() bool SdkAndPlatformVariantVisibleToMake() bool // SubName returns the modules SubName, used for image and NDK/SDK variations. SubName() string Loading rust/rust.go +15 −18 Original line number Diff line number Diff line Loading @@ -332,6 +332,20 @@ func (mod *Module) IsVndkSp() bool { 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 { return false } Loading Loading @@ -841,24 +855,7 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { toolchain := mod.toolchain(ctx) mod.makeLinkType = cc.GetMakeLinkType(actx, mod) // Differentiate static libraries that are vendor available 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 } mod.Properties.SubName = cc.GetSubnameProperty(actx, mod) if !toolchain.Supported() { // This toolchain's unsupported, there's nothing to do for this mod. Loading Loading
cc/cc.go +30 −17 Original line number Diff line number Diff line Loading @@ -1218,6 +1218,17 @@ func (c *Module) IsVendorPublicLibrary() bool { 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 { lib := moduleLibraryInterface(c) return lib != nil && lib.hasLLNDKStubs() Loading Loading @@ -1699,7 +1710,7 @@ func (c *Module) DataPaths() []android.DataPath { 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 // "current", it will append the VNDK version to the name suffix. var vndkVersion string Loading @@ -1719,19 +1730,19 @@ func (c *Module) getNameSuffixWithVndkVersion(ctx android.ModuleContext) string if vndkVersion == "current" { 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 // version in product or vendor partition. nameSuffix += "." + c.Properties.VndkVersion nameSuffix += "." + c.VndkVersion() } return nameSuffix } func (c *Module) setSubnameProperty(actx android.ModuleContext) { c.Properties.SubName = "" func GetSubnameProperty(actx android.ModuleContext, c LinkableInterface) string { var subName = "" if c.Target().NativeBridge == android.NativeBridgeEnabled { c.Properties.SubName += NativeBridgeSuffix subName += NativeBridgeSuffix } llndk := c.IsLlndk() Loading @@ -1739,25 +1750,27 @@ func (c *Module) setSubnameProperty(actx android.ModuleContext) { // .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 // 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() { c.Properties.SubName += vendorPublicLibrarySuffix } else if _, ok := c.linker.(*vndkPrebuiltLibraryDecorator); ok { subName += vendorPublicLibrarySuffix } else if c.IsVndkPrebuiltLibrary() { // .vendor suffix is added for backward compatibility with VNDK snapshot whose names with // such suffixes are already hard-coded in prebuilts/vndk/.../Android.bp. c.Properties.SubName += VendorSuffix subName += VendorSuffix } else if c.InRamdisk() && !c.OnlyInRamdisk() { c.Properties.SubName += RamdiskSuffix subName += RamdiskSuffix } else if c.InVendorRamdisk() && !c.OnlyInVendorRamdisk() { c.Properties.SubName += VendorRamdiskSuffix subName += VendorRamdiskSuffix } else if c.InRecovery() && !c.OnlyInRecovery() { c.Properties.SubName += RecoverySuffix } else if c.IsSdkVariant() && (c.Properties.SdkAndPlatformVariantVisibleToMake || c.SplitPerApiLevel()) { c.Properties.SubName += sdkSuffix subName += RecoverySuffix } else if c.IsSdkVariant() && (c.SdkAndPlatformVariantVisibleToMake() || c.SplitPerApiLevel()) { subName += sdkSuffix 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. Loading Loading @@ -1795,7 +1808,7 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { return } c.setSubnameProperty(actx) c.Properties.SubName = GetSubnameProperty(actx, c) apexInfo := actx.Provider(android.ApexInfoProvider).(android.ApexInfo) if !apexInfo.IsForPlatform() { c.hideApexVariantFromMake = true Loading
cc/linkable.go +4 −0 Original line number Diff line number Diff line Loading @@ -176,10 +176,14 @@ type LinkableInterface interface { IsVndk() bool IsVndkExt() bool IsVndkPrivate() bool IsVendorPublicLibrary() bool IsVndkPrebuiltLibrary() bool HasVendorVariant() bool HasProductVariant() bool HasNonSystemVariants() bool ProductSpecific() bool InProduct() bool SdkAndPlatformVariantVisibleToMake() bool // SubName returns the modules SubName, used for image and NDK/SDK variations. SubName() string Loading
rust/rust.go +15 −18 Original line number Diff line number Diff line Loading @@ -332,6 +332,20 @@ func (mod *Module) IsVndkSp() bool { 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 { return false } Loading Loading @@ -841,24 +855,7 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { toolchain := mod.toolchain(ctx) mod.makeLinkType = cc.GetMakeLinkType(actx, mod) // Differentiate static libraries that are vendor available 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 } mod.Properties.SubName = cc.GetSubnameProperty(actx, mod) if !toolchain.Supported() { // This toolchain's unsupported, there's nothing to do for this mod. Loading