Generate image variation without version
Current CC/Rust Image variations are generated with target VNDK version. However, this is no longer valid if VNDK is deprecated. This change generates image variation without version ("vendor", "product") if VNDK is deprecated. Bug: 316829758 Test: m nothing --no-skip-soong-tests passed Test: aosp_cf_x86_64_phone build succeeded Change-Id: I2387ed8a2632bfd9462621f882a947695ae1653d
This commit is contained in:
55
cc/image.go
55
cc/image.go
@@ -42,10 +42,18 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
// VendorVariation is the variant name used for /vendor code that does not
|
||||
// compile against the VNDK.
|
||||
VendorVariation = "vendor"
|
||||
|
||||
// VendorVariationPrefix is the variant prefix used for /vendor code that compiles
|
||||
// against the VNDK.
|
||||
VendorVariationPrefix = "vendor."
|
||||
|
||||
// ProductVariation is the variant name used for /product code that does not
|
||||
// compile against the VNDK.
|
||||
ProductVariation = "product"
|
||||
|
||||
// ProductVariationPrefix is the variant prefix used for /product code that compiles
|
||||
// against the VNDK.
|
||||
ProductVariationPrefix = "product."
|
||||
@@ -112,12 +120,12 @@ func (c *Module) HasNonSystemVariants() bool {
|
||||
|
||||
// Returns true if the module is "product" variant. Usually these modules are installed in /product
|
||||
func (c *Module) InProduct() bool {
|
||||
return c.Properties.ImageVariationPrefix == ProductVariationPrefix
|
||||
return c.Properties.ImageVariation == ProductVariation
|
||||
}
|
||||
|
||||
// Returns true if the module is "vendor" variant. Usually these modules are installed in /vendor
|
||||
func (c *Module) InVendor() bool {
|
||||
return c.Properties.ImageVariationPrefix == VendorVariationPrefix
|
||||
return c.Properties.ImageVariation == VendorVariation
|
||||
}
|
||||
|
||||
func (c *Module) InRamdisk() bool {
|
||||
@@ -439,10 +447,8 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
||||
// and vendor and product variants will be created with LLNDK stubs.
|
||||
// The LLNDK libraries need vendor variants even if there is no VNDK.
|
||||
coreVariantNeeded = true
|
||||
if platformVndkVersion != "" {
|
||||
vendorVariants = append(vendorVariants, platformVndkVersion)
|
||||
productVariants = append(productVariants, platformVndkVersion)
|
||||
}
|
||||
vendorVariants = append(vendorVariants, platformVndkVersion)
|
||||
productVariants = append(productVariants, platformVndkVersion)
|
||||
// Generate vendor variants for boardVndkVersion only if the VNDK snapshot does not
|
||||
// provide the LLNDK stub libraries.
|
||||
if needVndkVersionVendorVariantForLlndk {
|
||||
@@ -453,13 +459,7 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
||||
// for system and product.
|
||||
coreVariantNeeded = true
|
||||
vendorVariants = append(vendorVariants, boardVndkVersion)
|
||||
if platformVndkVersion != "" {
|
||||
productVariants = append(productVariants, platformVndkVersion)
|
||||
}
|
||||
} else if boardVndkVersion == "" {
|
||||
// If the device isn't compiling against the VNDK, we always
|
||||
// use the core mode.
|
||||
coreVariantNeeded = true
|
||||
productVariants = append(productVariants, platformVndkVersion)
|
||||
} else if m.IsSnapshotPrebuilt() {
|
||||
// Make vendor variants only for the versions in BOARD_VNDK_VERSION and
|
||||
// PRODUCT_EXTRA_VNDK_VERSIONS.
|
||||
@@ -557,11 +557,19 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
||||
}
|
||||
|
||||
for _, variant := range android.FirstUniqueStrings(vendorVariants) {
|
||||
m.AppendExtraVariant(VendorVariationPrefix + variant)
|
||||
if variant == "" {
|
||||
m.AppendExtraVariant(VendorVariation)
|
||||
} else {
|
||||
m.AppendExtraVariant(VendorVariationPrefix + variant)
|
||||
}
|
||||
}
|
||||
|
||||
for _, variant := range android.FirstUniqueStrings(productVariants) {
|
||||
m.AppendExtraVariant(ProductVariationPrefix + variant)
|
||||
if variant == "" {
|
||||
m.AppendExtraVariant(ProductVariation)
|
||||
} else {
|
||||
m.AppendExtraVariant(ProductVariationPrefix + variant)
|
||||
}
|
||||
}
|
||||
|
||||
m.SetRamdiskVariantNeeded(ramdiskVariantNeeded)
|
||||
@@ -672,9 +680,12 @@ func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string
|
||||
} else if variant == android.RecoveryVariation {
|
||||
m.MakeAsPlatform()
|
||||
squashRecoverySrcs(m)
|
||||
} else if strings.HasPrefix(variant, VendorVariationPrefix) {
|
||||
m.Properties.ImageVariationPrefix = VendorVariationPrefix
|
||||
m.Properties.VndkVersion = strings.TrimPrefix(variant, VendorVariationPrefix)
|
||||
} else if strings.HasPrefix(variant, VendorVariation) {
|
||||
m.Properties.ImageVariation = VendorVariation
|
||||
|
||||
if strings.HasPrefix(variant, VendorVariationPrefix) {
|
||||
m.Properties.VndkVersion = strings.TrimPrefix(variant, VendorVariationPrefix)
|
||||
}
|
||||
squashVendorSrcs(m)
|
||||
|
||||
// Makefile shouldn't know vendor modules other than BOARD_VNDK_VERSION.
|
||||
@@ -684,9 +695,11 @@ func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string
|
||||
m.Properties.HideFromMake = true
|
||||
m.HideFromMake()
|
||||
}
|
||||
} else if strings.HasPrefix(variant, ProductVariationPrefix) {
|
||||
m.Properties.ImageVariationPrefix = ProductVariationPrefix
|
||||
m.Properties.VndkVersion = strings.TrimPrefix(variant, ProductVariationPrefix)
|
||||
} else if strings.HasPrefix(variant, ProductVariation) {
|
||||
m.Properties.ImageVariation = ProductVariation
|
||||
if strings.HasPrefix(variant, ProductVariationPrefix) {
|
||||
m.Properties.VndkVersion = strings.TrimPrefix(variant, ProductVariationPrefix)
|
||||
}
|
||||
squashProductSrcs(m)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user