Merge "Move vendor and product variant generation logic from cc package to android package" into main
This commit is contained in:
@@ -19,6 +19,12 @@ type ImageInterface interface {
|
|||||||
// ImageMutatorBegin is called before any other method in the ImageInterface.
|
// ImageMutatorBegin is called before any other method in the ImageInterface.
|
||||||
ImageMutatorBegin(ctx BaseModuleContext)
|
ImageMutatorBegin(ctx BaseModuleContext)
|
||||||
|
|
||||||
|
// VendorVariantNeeded should return true if the module needs a vendor variant (installed on the vendor image).
|
||||||
|
VendorVariantNeeded(ctx BaseModuleContext) bool
|
||||||
|
|
||||||
|
// ProductVariantNeeded should return true if the module needs a product variant (unstalled on the product image).
|
||||||
|
ProductVariantNeeded(ctx BaseModuleContext) bool
|
||||||
|
|
||||||
// CoreVariantNeeded should return true if the module needs a core variant (installed on the system image).
|
// CoreVariantNeeded should return true if the module needs a core variant (installed on the system image).
|
||||||
CoreVariantNeeded(ctx BaseModuleContext) bool
|
CoreVariantNeeded(ctx BaseModuleContext) bool
|
||||||
|
|
||||||
@@ -49,6 +55,14 @@ type ImageInterface interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// VendorVariation is the variant name used for /vendor code that does not
|
||||||
|
// compile against the VNDK.
|
||||||
|
VendorVariation string = "vendor"
|
||||||
|
|
||||||
|
// ProductVariation is the variant name used for /product code that does not
|
||||||
|
// compile against the VNDK.
|
||||||
|
ProductVariation string = "product"
|
||||||
|
|
||||||
// CoreVariation is the variant used for framework-private libraries, or
|
// CoreVariation is the variant used for framework-private libraries, or
|
||||||
// SDK libraries. (which framework-private libraries can use), which
|
// SDK libraries. (which framework-private libraries can use), which
|
||||||
// will be installed to the system image.
|
// will be installed to the system image.
|
||||||
@@ -94,6 +108,12 @@ func imageMutator(ctx BottomUpMutatorContext) {
|
|||||||
if m.RecoveryVariantNeeded(ctx) {
|
if m.RecoveryVariantNeeded(ctx) {
|
||||||
variations = append(variations, RecoveryVariation)
|
variations = append(variations, RecoveryVariation)
|
||||||
}
|
}
|
||||||
|
if m.VendorVariantNeeded(ctx) {
|
||||||
|
variations = append(variations, VendorVariation)
|
||||||
|
}
|
||||||
|
if m.ProductVariantNeeded(ctx) {
|
||||||
|
variations = append(variations, ProductVariation)
|
||||||
|
}
|
||||||
|
|
||||||
extraVariations := m.ExtraImageVariations(ctx)
|
extraVariations := m.ExtraImageVariations(ctx)
|
||||||
variations = append(variations, extraVariations...)
|
variations = append(variations, extraVariations...)
|
||||||
|
@@ -748,9 +748,9 @@ func (a *apexBundle) getImageVariationPair() (string, string) {
|
|||||||
|
|
||||||
prefix := android.CoreVariation
|
prefix := android.CoreVariation
|
||||||
if a.SocSpecific() || a.DeviceSpecific() {
|
if a.SocSpecific() || a.DeviceSpecific() {
|
||||||
prefix = cc.VendorVariation
|
prefix = android.VendorVariation
|
||||||
} else if a.ProductSpecific() {
|
} else if a.ProductSpecific() {
|
||||||
prefix = cc.ProductVariation
|
prefix = android.ProductVariation
|
||||||
}
|
}
|
||||||
|
|
||||||
return prefix, ""
|
return prefix, ""
|
||||||
|
11
bpf/bpf.go
11
bpf/bpf.go
@@ -104,6 +104,14 @@ var _ android.ImageInterface = (*bpf)(nil)
|
|||||||
|
|
||||||
func (bpf *bpf) ImageMutatorBegin(ctx android.BaseModuleContext) {}
|
func (bpf *bpf) ImageMutatorBegin(ctx android.BaseModuleContext) {}
|
||||||
|
|
||||||
|
func (bpf *bpf) VendorVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return proptools.Bool(bpf.properties.Vendor)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (bpf *bpf) ProductVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (bpf *bpf) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
func (bpf *bpf) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
return !proptools.Bool(bpf.properties.Vendor)
|
return !proptools.Bool(bpf.properties.Vendor)
|
||||||
}
|
}
|
||||||
@@ -125,9 +133,6 @@ func (bpf *bpf) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (bpf *bpf) ExtraImageVariations(ctx android.BaseModuleContext) []string {
|
func (bpf *bpf) ExtraImageVariations(ctx android.BaseModuleContext) []string {
|
||||||
if proptools.Bool(bpf.properties.Vendor) {
|
|
||||||
return []string{"vendor"}
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
cc/cc.go
4
cc/cc.go
@@ -361,6 +361,8 @@ type BaseProperties struct {
|
|||||||
Recovery_available *bool
|
Recovery_available *bool
|
||||||
|
|
||||||
// Used by imageMutator, set by ImageMutatorBegin()
|
// Used by imageMutator, set by ImageMutatorBegin()
|
||||||
|
VendorVariantNeeded bool `blueprint:"mutated"`
|
||||||
|
ProductVariantNeeded bool `blueprint:"mutated"`
|
||||||
CoreVariantNeeded bool `blueprint:"mutated"`
|
CoreVariantNeeded bool `blueprint:"mutated"`
|
||||||
RamdiskVariantNeeded bool `blueprint:"mutated"`
|
RamdiskVariantNeeded bool `blueprint:"mutated"`
|
||||||
VendorRamdiskVariantNeeded bool `blueprint:"mutated"`
|
VendorRamdiskVariantNeeded bool `blueprint:"mutated"`
|
||||||
@@ -2509,7 +2511,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
if c.ImageVariation().Variation == android.CoreVariation && c.Device() &&
|
if c.ImageVariation().Variation == android.CoreVariation && c.Device() &&
|
||||||
c.Target().NativeBridge == android.NativeBridgeDisabled {
|
c.Target().NativeBridge == android.NativeBridgeDisabled {
|
||||||
actx.AddVariationDependencies(
|
actx.AddVariationDependencies(
|
||||||
[]blueprint.Variation{{Mutator: "image", Variation: VendorVariation}},
|
[]blueprint.Variation{{Mutator: "image", Variation: android.VendorVariation}},
|
||||||
llndkHeaderLibTag,
|
llndkHeaderLibTag,
|
||||||
deps.LlndkHeaderLibs...)
|
deps.LlndkHeaderLibs...)
|
||||||
}
|
}
|
||||||
|
@@ -79,6 +79,14 @@ var _ android.ImageInterface = (*GenruleExtraProperties)(nil)
|
|||||||
|
|
||||||
func (g *GenruleExtraProperties) ImageMutatorBegin(ctx android.BaseModuleContext) {}
|
func (g *GenruleExtraProperties) ImageMutatorBegin(ctx android.BaseModuleContext) {}
|
||||||
|
|
||||||
|
func (g *GenruleExtraProperties) VendorVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return Bool(g.Vendor_available) || Bool(g.Odm_available) || ctx.SocSpecific() || ctx.DeviceSpecific()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GenruleExtraProperties) ProductVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return Bool(g.Product_available) || ctx.ProductSpecific()
|
||||||
|
}
|
||||||
|
|
||||||
func (g *GenruleExtraProperties) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
func (g *GenruleExtraProperties) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
return !(ctx.SocSpecific() || ctx.DeviceSpecific() || ctx.ProductSpecific())
|
return !(ctx.SocSpecific() || ctx.DeviceSpecific() || ctx.ProductSpecific())
|
||||||
}
|
}
|
||||||
@@ -102,18 +110,7 @@ func (g *GenruleExtraProperties) RecoveryVariantNeeded(ctx android.BaseModuleCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *GenruleExtraProperties) ExtraImageVariations(ctx android.BaseModuleContext) []string {
|
func (g *GenruleExtraProperties) ExtraImageVariations(ctx android.BaseModuleContext) []string {
|
||||||
var variants []string
|
return nil
|
||||||
vendorVariantRequired := Bool(g.Vendor_available) || Bool(g.Odm_available) || ctx.SocSpecific() || ctx.DeviceSpecific()
|
|
||||||
productVariantRequired := Bool(g.Product_available) || ctx.ProductSpecific()
|
|
||||||
|
|
||||||
if vendorVariantRequired {
|
|
||||||
variants = append(variants, VendorVariation)
|
|
||||||
}
|
|
||||||
if productVariantRequired {
|
|
||||||
variants = append(variants, ProductVariation)
|
|
||||||
}
|
|
||||||
|
|
||||||
return variants
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GenruleExtraProperties) SetImageVariation(ctx android.BaseModuleContext, variation string) {
|
func (g *GenruleExtraProperties) SetImageVariation(ctx android.BaseModuleContext, variation string) {
|
||||||
|
93
cc/image.go
93
cc/image.go
@@ -39,18 +39,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
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
|
// VendorVariationPrefix is the variant prefix used for /vendor code that compiles
|
||||||
// against the VNDK.
|
// against the VNDK.
|
||||||
VendorVariationPrefix = "vendor."
|
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
|
// ProductVariationPrefix is the variant prefix used for /product code that compiles
|
||||||
// against the VNDK.
|
// against the VNDK.
|
||||||
ProductVariationPrefix = "product."
|
ProductVariationPrefix = "product."
|
||||||
@@ -117,12 +109,12 @@ func (c *Module) HasNonSystemVariants() bool {
|
|||||||
|
|
||||||
// Returns true if the module is "product" variant. Usually these modules are installed in /product
|
// Returns true if the module is "product" variant. Usually these modules are installed in /product
|
||||||
func (c *Module) InProduct() bool {
|
func (c *Module) InProduct() bool {
|
||||||
return c.Properties.ImageVariation == ProductVariation
|
return c.Properties.ImageVariation == android.ProductVariation
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the module is "vendor" variant. Usually these modules are installed in /vendor
|
// Returns true if the module is "vendor" variant. Usually these modules are installed in /vendor
|
||||||
func (c *Module) InVendor() bool {
|
func (c *Module) InVendor() bool {
|
||||||
return c.Properties.ImageVariation == VendorVariation
|
return c.Properties.ImageVariation == android.VendorVariation
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the module is "vendor" or "product" variant. This replaces previous UseVndk usages
|
// Returns true if the module is "vendor" or "product" variant. This replaces previous UseVndk usages
|
||||||
@@ -207,6 +199,12 @@ type ImageMutatableModule interface {
|
|||||||
|
|
||||||
// SetCoreVariantNeeded sets whether the Core Variant is needed.
|
// SetCoreVariantNeeded sets whether the Core Variant is needed.
|
||||||
SetCoreVariantNeeded(b bool)
|
SetCoreVariantNeeded(b bool)
|
||||||
|
|
||||||
|
// SetProductVariantNeeded sets whether the Product Variant is needed.
|
||||||
|
SetProductVariantNeeded(b bool)
|
||||||
|
|
||||||
|
// SetVendorVariantNeeded sets whether the Vendor Variant is needed.
|
||||||
|
SetVendorVariantNeeded(b bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ ImageMutatableModule = (*Module)(nil)
|
var _ ImageMutatableModule = (*Module)(nil)
|
||||||
@@ -267,6 +265,14 @@ func (m *Module) SetCoreVariantNeeded(b bool) {
|
|||||||
m.Properties.CoreVariantNeeded = b
|
m.Properties.CoreVariantNeeded = b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Module) SetProductVariantNeeded(b bool) {
|
||||||
|
m.Properties.ProductVariantNeeded = b
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Module) SetVendorVariantNeeded(b bool) {
|
||||||
|
m.Properties.VendorVariantNeeded = b
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Module) SnapshotVersion(mctx android.BaseModuleContext) string {
|
func (m *Module) SnapshotVersion(mctx android.BaseModuleContext) string {
|
||||||
if snapshot, ok := m.linker.(SnapshotInterface); ok {
|
if snapshot, ok := m.linker.(SnapshotInterface); ok {
|
||||||
return snapshot.Version()
|
return snapshot.Version()
|
||||||
@@ -319,41 +325,34 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var vendorVariantNeeded bool = false
|
||||||
|
var productVariantNeeded bool = false
|
||||||
var coreVariantNeeded bool = false
|
var coreVariantNeeded bool = false
|
||||||
var ramdiskVariantNeeded bool = false
|
var ramdiskVariantNeeded bool = false
|
||||||
var vendorRamdiskVariantNeeded bool = false
|
var vendorRamdiskVariantNeeded bool = false
|
||||||
var recoveryVariantNeeded bool = false
|
var recoveryVariantNeeded bool = false
|
||||||
|
|
||||||
var vendorVariants []string
|
|
||||||
var productVariants []string
|
|
||||||
|
|
||||||
needVndkVersionVendorVariantForLlndk := false
|
|
||||||
|
|
||||||
if m.NeedsLlndkVariants() {
|
if m.NeedsLlndkVariants() {
|
||||||
// This is an LLNDK library. The implementation of the library will be on /system,
|
// This is an LLNDK library. The implementation of the library will be on /system,
|
||||||
// and vendor and product variants will be created with LLNDK stubs.
|
// and vendor and product variants will be created with LLNDK stubs.
|
||||||
// The LLNDK libraries need vendor variants even if there is no VNDK.
|
// The LLNDK libraries need vendor variants even if there is no VNDK.
|
||||||
coreVariantNeeded = true
|
coreVariantNeeded = true
|
||||||
vendorVariants = append(vendorVariants, "")
|
vendorVariantNeeded = true
|
||||||
productVariants = append(productVariants, "")
|
productVariantNeeded = true
|
||||||
// Generate vendor variants for boardVndkVersion only if the VNDK snapshot does not
|
|
||||||
// provide the LLNDK stub libraries.
|
|
||||||
if needVndkVersionVendorVariantForLlndk {
|
|
||||||
vendorVariants = append(vendorVariants, "")
|
|
||||||
}
|
|
||||||
} else if m.NeedsVendorPublicLibraryVariants() {
|
} else if m.NeedsVendorPublicLibraryVariants() {
|
||||||
// A vendor public library has the implementation on /vendor, with stub variants
|
// A vendor public library has the implementation on /vendor, with stub variants
|
||||||
// for system and product.
|
// for system and product.
|
||||||
coreVariantNeeded = true
|
coreVariantNeeded = true
|
||||||
vendorVariants = append(vendorVariants, "")
|
vendorVariantNeeded = true
|
||||||
productVariants = append(productVariants, "")
|
productVariantNeeded = true
|
||||||
} else if m.IsSnapshotPrebuilt() {
|
} else if m.IsSnapshotPrebuilt() {
|
||||||
// Make vendor variants only for the versions in BOARD_VNDK_VERSION and
|
// Make vendor variants only for the versions in BOARD_VNDK_VERSION and
|
||||||
// PRODUCT_EXTRA_VNDK_VERSIONS.
|
// PRODUCT_EXTRA_VNDK_VERSIONS.
|
||||||
if m.InstallInRecovery() {
|
if m.InstallInRecovery() {
|
||||||
recoveryVariantNeeded = true
|
recoveryVariantNeeded = true
|
||||||
} else {
|
} else {
|
||||||
vendorVariants = append(vendorVariants, m.SnapshotVersion(mctx))
|
m.AppendExtraVariant(VendorVariationPrefix + m.SnapshotVersion(mctx))
|
||||||
}
|
}
|
||||||
} else if m.HasNonSystemVariants() {
|
} else if m.HasNonSystemVariants() {
|
||||||
// This will be available to /system unless it is product_specific
|
// This will be available to /system unless it is product_specific
|
||||||
@@ -364,16 +363,16 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
|||||||
// BOARD_VNDK_VERSION. The other modules are regarded as AOSP, or
|
// BOARD_VNDK_VERSION. The other modules are regarded as AOSP, or
|
||||||
// PLATFORM_VNDK_VERSION.
|
// PLATFORM_VNDK_VERSION.
|
||||||
if m.HasVendorVariant() {
|
if m.HasVendorVariant() {
|
||||||
vendorVariants = append(vendorVariants, "")
|
vendorVariantNeeded = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// product_available modules are available to /product.
|
// product_available modules are available to /product.
|
||||||
if m.HasProductVariant() {
|
if m.HasProductVariant() {
|
||||||
productVariants = append(productVariants, "")
|
productVariantNeeded = true
|
||||||
}
|
}
|
||||||
} else if vendorSpecific && m.SdkVersion() == "" {
|
} else if vendorSpecific && m.SdkVersion() == "" {
|
||||||
// This will be available in /vendor (or /odm) only
|
// This will be available in /vendor (or /odm) only
|
||||||
vendorVariants = append(vendorVariants, "")
|
vendorVariantNeeded = true
|
||||||
} else {
|
} else {
|
||||||
// This is either in /system (or similar: /data), or is a
|
// This is either in /system (or similar: /data), or is a
|
||||||
// module built with the NDK. Modules built with the NDK
|
// module built with the NDK. Modules built with the NDK
|
||||||
@@ -384,7 +383,7 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
|||||||
if coreVariantNeeded && productSpecific && m.SdkVersion() == "" {
|
if coreVariantNeeded && productSpecific && m.SdkVersion() == "" {
|
||||||
// The module has "product_specific: true" that does not create core variant.
|
// The module has "product_specific: true" that does not create core variant.
|
||||||
coreVariantNeeded = false
|
coreVariantNeeded = false
|
||||||
productVariants = append(productVariants, "")
|
productVariantNeeded = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.RamdiskAvailable() {
|
if m.RamdiskAvailable() {
|
||||||
@@ -414,36 +413,32 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
|||||||
coreVariantNeeded = false
|
coreVariantNeeded = false
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, variant := range android.FirstUniqueStrings(vendorVariants) {
|
|
||||||
if variant == "" {
|
|
||||||
m.AppendExtraVariant(VendorVariation)
|
|
||||||
} else {
|
|
||||||
m.AppendExtraVariant(VendorVariationPrefix + variant)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, variant := range android.FirstUniqueStrings(productVariants) {
|
|
||||||
if variant == "" {
|
|
||||||
m.AppendExtraVariant(ProductVariation)
|
|
||||||
} else {
|
|
||||||
m.AppendExtraVariant(ProductVariationPrefix + variant)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m.SetRamdiskVariantNeeded(ramdiskVariantNeeded)
|
m.SetRamdiskVariantNeeded(ramdiskVariantNeeded)
|
||||||
m.SetVendorRamdiskVariantNeeded(vendorRamdiskVariantNeeded)
|
m.SetVendorRamdiskVariantNeeded(vendorRamdiskVariantNeeded)
|
||||||
m.SetRecoveryVariantNeeded(recoveryVariantNeeded)
|
m.SetRecoveryVariantNeeded(recoveryVariantNeeded)
|
||||||
m.SetCoreVariantNeeded(coreVariantNeeded)
|
m.SetCoreVariantNeeded(coreVariantNeeded)
|
||||||
|
m.SetProductVariantNeeded(productVariantNeeded)
|
||||||
|
m.SetVendorVariantNeeded(vendorVariantNeeded)
|
||||||
|
|
||||||
// Disable the module if no variants are needed.
|
// Disable the module if no variants are needed.
|
||||||
if !ramdiskVariantNeeded &&
|
if !ramdiskVariantNeeded &&
|
||||||
!recoveryVariantNeeded &&
|
!recoveryVariantNeeded &&
|
||||||
!coreVariantNeeded &&
|
!coreVariantNeeded &&
|
||||||
|
!productVariantNeeded &&
|
||||||
|
!vendorVariantNeeded &&
|
||||||
len(m.ExtraVariants()) == 0 {
|
len(m.ExtraVariants()) == 0 {
|
||||||
m.Disable()
|
m.Disable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Module) VendorVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return c.Properties.VendorVariantNeeded
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Module) ProductVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return c.Properties.ProductVariantNeeded
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Module) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
func (c *Module) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
return c.Properties.CoreVariantNeeded
|
return c.Properties.CoreVariantNeeded
|
||||||
}
|
}
|
||||||
@@ -537,15 +532,15 @@ func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string
|
|||||||
} else if variant == android.RecoveryVariation {
|
} else if variant == android.RecoveryVariation {
|
||||||
c.MakeAsPlatform()
|
c.MakeAsPlatform()
|
||||||
squashRecoverySrcs(c)
|
squashRecoverySrcs(c)
|
||||||
} else if strings.HasPrefix(variant, VendorVariation) {
|
} else if strings.HasPrefix(variant, android.VendorVariation) {
|
||||||
c.Properties.ImageVariation = VendorVariation
|
c.Properties.ImageVariation = android.VendorVariation
|
||||||
|
|
||||||
if strings.HasPrefix(variant, VendorVariationPrefix) {
|
if strings.HasPrefix(variant, VendorVariationPrefix) {
|
||||||
c.Properties.VndkVersion = strings.TrimPrefix(variant, VendorVariationPrefix)
|
c.Properties.VndkVersion = strings.TrimPrefix(variant, VendorVariationPrefix)
|
||||||
}
|
}
|
||||||
squashVendorSrcs(c)
|
squashVendorSrcs(c)
|
||||||
} else if strings.HasPrefix(variant, ProductVariation) {
|
} else if strings.HasPrefix(variant, android.ProductVariation) {
|
||||||
c.Properties.ImageVariation = ProductVariation
|
c.Properties.ImageVariation = android.ProductVariation
|
||||||
if strings.HasPrefix(variant, ProductVariationPrefix) {
|
if strings.HasPrefix(variant, ProductVariationPrefix) {
|
||||||
c.Properties.VndkVersion = strings.TrimPrefix(variant, ProductVariationPrefix)
|
c.Properties.VndkVersion = strings.TrimPrefix(variant, ProductVariationPrefix)
|
||||||
}
|
}
|
||||||
|
@@ -494,6 +494,12 @@ func BuildApiVariantName(baseName string, variant string, version string) string
|
|||||||
|
|
||||||
// Implement ImageInterface to generate image variants
|
// Implement ImageInterface to generate image variants
|
||||||
func (v *CcApiVariant) ImageMutatorBegin(ctx android.BaseModuleContext) {}
|
func (v *CcApiVariant) ImageMutatorBegin(ctx android.BaseModuleContext) {}
|
||||||
|
func (v *CcApiVariant) VendorVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return String(v.properties.Variant) == "llndk"
|
||||||
|
}
|
||||||
|
func (v *CcApiVariant) ProductVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return String(v.properties.Variant) == "llndk"
|
||||||
|
}
|
||||||
func (v *CcApiVariant) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
func (v *CcApiVariant) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
return inList(String(v.properties.Variant), []string{"ndk", "apex"})
|
return inList(String(v.properties.Variant), []string{"ndk", "apex"})
|
||||||
}
|
}
|
||||||
@@ -501,15 +507,6 @@ func (v *CcApiVariant) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool
|
|||||||
func (v *CcApiVariant) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { return false }
|
func (v *CcApiVariant) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { return false }
|
||||||
func (v *CcApiVariant) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { return false }
|
func (v *CcApiVariant) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { return false }
|
||||||
func (v *CcApiVariant) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool { return false }
|
func (v *CcApiVariant) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool { return false }
|
||||||
func (v *CcApiVariant) ExtraImageVariations(ctx android.BaseModuleContext) []string {
|
func (v *CcApiVariant) ExtraImageVariations(ctx android.BaseModuleContext) []string { return nil }
|
||||||
var variations []string
|
|
||||||
|
|
||||||
if String(v.properties.Variant) == "llndk" {
|
|
||||||
variations = append(variations, VendorVariation)
|
|
||||||
variations = append(variations, ProductVariation)
|
|
||||||
}
|
|
||||||
|
|
||||||
return variations
|
|
||||||
}
|
|
||||||
func (v *CcApiVariant) SetImageVariation(ctx android.BaseModuleContext, variation string) {
|
func (v *CcApiVariant) SetImageVariation(ctx android.BaseModuleContext, variation string) {
|
||||||
}
|
}
|
||||||
|
@@ -216,6 +216,14 @@ var _ android.ImageInterface = (*PrebuiltEtc)(nil)
|
|||||||
|
|
||||||
func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.BaseModuleContext) {}
|
func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.BaseModuleContext) {}
|
||||||
|
|
||||||
|
func (p *PrebuiltEtc) VendorVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PrebuiltEtc) ProductVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() &&
|
return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() &&
|
||||||
!p.ModuleBase.InstallInVendorRamdisk() && !p.ModuleBase.InstallInDebugRamdisk()
|
!p.ModuleBase.InstallInVendorRamdisk() && !p.ModuleBase.InstallInDebugRamdisk()
|
||||||
|
@@ -643,6 +643,8 @@ func generatorFactory(taskGenerator taskFunc, props ...interface{}) *Module {
|
|||||||
type noopImageInterface struct{}
|
type noopImageInterface struct{}
|
||||||
|
|
||||||
func (x noopImageInterface) ImageMutatorBegin(android.BaseModuleContext) {}
|
func (x noopImageInterface) ImageMutatorBegin(android.BaseModuleContext) {}
|
||||||
|
func (x noopImageInterface) VendorVariantNeeded(android.BaseModuleContext) bool { return false }
|
||||||
|
func (x noopImageInterface) ProductVariantNeeded(android.BaseModuleContext) bool { return false }
|
||||||
func (x noopImageInterface) CoreVariantNeeded(android.BaseModuleContext) bool { return false }
|
func (x noopImageInterface) CoreVariantNeeded(android.BaseModuleContext) bool { return false }
|
||||||
func (x noopImageInterface) RamdiskVariantNeeded(android.BaseModuleContext) bool { return false }
|
func (x noopImageInterface) RamdiskVariantNeeded(android.BaseModuleContext) bool { return false }
|
||||||
func (x noopImageInterface) VendorRamdiskVariantNeeded(android.BaseModuleContext) bool { return false }
|
func (x noopImageInterface) VendorRamdiskVariantNeeded(android.BaseModuleContext) bool { return false }
|
||||||
|
@@ -77,6 +77,14 @@ func (mod *Module) SetCoreVariantNeeded(b bool) {
|
|||||||
mod.Properties.CoreVariantNeeded = b
|
mod.Properties.CoreVariantNeeded = b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mod *Module) SetProductVariantNeeded(b bool) {
|
||||||
|
mod.Properties.ProductVariantNeeded = b
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *Module) SetVendorVariantNeeded(b bool) {
|
||||||
|
mod.Properties.VendorVariantNeeded = b
|
||||||
|
}
|
||||||
|
|
||||||
func (mod *Module) SnapshotVersion(mctx android.BaseModuleContext) string {
|
func (mod *Module) SnapshotVersion(mctx android.BaseModuleContext) string {
|
||||||
if snapshot, ok := mod.compiler.(cc.SnapshotInterface); ok {
|
if snapshot, ok := mod.compiler.(cc.SnapshotInterface); ok {
|
||||||
return snapshot.Version()
|
return snapshot.Version()
|
||||||
@@ -86,6 +94,14 @@ func (mod *Module) SnapshotVersion(mctx android.BaseModuleContext) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mod *Module) VendorVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return mod.Properties.VendorVariantNeeded
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mod *Module) ProductVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return mod.Properties.ProductVariantNeeded
|
||||||
|
}
|
||||||
|
|
||||||
func (mod *Module) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
|
func (mod *Module) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
return mod.Properties.VendorRamdiskVariantNeeded
|
return mod.Properties.VendorRamdiskVariantNeeded
|
||||||
}
|
}
|
||||||
@@ -184,12 +200,12 @@ func (mod *Module) HasNonSystemVariants() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) InProduct() bool {
|
func (mod *Module) InProduct() bool {
|
||||||
return mod.Properties.ImageVariation == cc.ProductVariation
|
return mod.Properties.ImageVariation == android.ProductVariation
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the module is "vendor" variant. Usually these modules are installed in /vendor
|
// Returns true if the module is "vendor" variant. Usually these modules are installed in /vendor
|
||||||
func (mod *Module) InVendor() bool {
|
func (mod *Module) InVendor() bool {
|
||||||
return mod.Properties.ImageVariation == cc.VendorVariation
|
return mod.Properties.ImageVariation == android.VendorVariation
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the module is "vendor" or "product" variant.
|
// Returns true if the module is "vendor" or "product" variant.
|
||||||
@@ -202,13 +218,13 @@ func (mod *Module) SetImageVariation(ctx android.BaseModuleContext, variant stri
|
|||||||
mod.MakeAsPlatform()
|
mod.MakeAsPlatform()
|
||||||
} else if variant == android.RecoveryVariation {
|
} else if variant == android.RecoveryVariation {
|
||||||
mod.MakeAsPlatform()
|
mod.MakeAsPlatform()
|
||||||
} else if strings.HasPrefix(variant, cc.VendorVariation) {
|
} else if strings.HasPrefix(variant, android.VendorVariation) {
|
||||||
mod.Properties.ImageVariation = cc.VendorVariation
|
mod.Properties.ImageVariation = android.VendorVariation
|
||||||
if strings.HasPrefix(variant, cc.VendorVariationPrefix) {
|
if strings.HasPrefix(variant, cc.VendorVariationPrefix) {
|
||||||
mod.Properties.VndkVersion = strings.TrimPrefix(variant, cc.VendorVariationPrefix)
|
mod.Properties.VndkVersion = strings.TrimPrefix(variant, cc.VendorVariationPrefix)
|
||||||
}
|
}
|
||||||
} else if strings.HasPrefix(variant, cc.ProductVariation) {
|
} else if strings.HasPrefix(variant, android.ProductVariation) {
|
||||||
mod.Properties.ImageVariation = cc.ProductVariation
|
mod.Properties.ImageVariation = android.ProductVariation
|
||||||
if strings.HasPrefix(variant, cc.ProductVariationPrefix) {
|
if strings.HasPrefix(variant, cc.ProductVariationPrefix) {
|
||||||
mod.Properties.VndkVersion = strings.TrimPrefix(variant, cc.ProductVariationPrefix)
|
mod.Properties.VndkVersion = strings.TrimPrefix(variant, cc.ProductVariationPrefix)
|
||||||
}
|
}
|
||||||
|
@@ -80,6 +80,8 @@ type BaseProperties struct {
|
|||||||
RustSubName string `blueprint:"mutated"`
|
RustSubName string `blueprint:"mutated"`
|
||||||
|
|
||||||
// Set by imageMutator
|
// Set by imageMutator
|
||||||
|
ProductVariantNeeded bool `blueprint:"mutated"`
|
||||||
|
VendorVariantNeeded bool `blueprint:"mutated"`
|
||||||
CoreVariantNeeded bool `blueprint:"mutated"`
|
CoreVariantNeeded bool `blueprint:"mutated"`
|
||||||
VendorRamdiskVariantNeeded bool `blueprint:"mutated"`
|
VendorRamdiskVariantNeeded bool `blueprint:"mutated"`
|
||||||
RamdiskVariantNeeded bool `blueprint:"mutated"`
|
RamdiskVariantNeeded bool `blueprint:"mutated"`
|
||||||
|
@@ -212,6 +212,14 @@ var _ android.ImageInterface = (*ShBinary)(nil)
|
|||||||
|
|
||||||
func (s *ShBinary) ImageMutatorBegin(ctx android.BaseModuleContext) {}
|
func (s *ShBinary) ImageMutatorBegin(ctx android.BaseModuleContext) {}
|
||||||
|
|
||||||
|
func (s *ShBinary) VendorVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return s.InstallInVendor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *ShBinary) ProductVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
|
return s.InstallInProduct()
|
||||||
|
}
|
||||||
|
|
||||||
func (s *ShBinary) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
func (s *ShBinary) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
return !s.InstallInRecovery() && !s.InstallInRamdisk() && !s.InstallInVendorRamdisk() && !s.ModuleBase.InstallInVendor()
|
return !s.InstallInRecovery() && !s.InstallInRamdisk() && !s.InstallInVendorRamdisk() && !s.ModuleBase.InstallInVendor()
|
||||||
}
|
}
|
||||||
@@ -233,14 +241,7 @@ func (s *ShBinary) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ShBinary) ExtraImageVariations(ctx android.BaseModuleContext) []string {
|
func (s *ShBinary) ExtraImageVariations(ctx android.BaseModuleContext) []string {
|
||||||
extraVariations := []string{}
|
return nil
|
||||||
if s.InstallInProduct() {
|
|
||||||
extraVariations = append(extraVariations, cc.ProductVariation)
|
|
||||||
}
|
|
||||||
if s.InstallInVendor() {
|
|
||||||
extraVariations = append(extraVariations, cc.VendorVariation)
|
|
||||||
}
|
|
||||||
return extraVariations
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ShBinary) SetImageVariation(ctx android.BaseModuleContext, variation string) {
|
func (s *ShBinary) SetImageVariation(ctx android.BaseModuleContext, variation string) {
|
||||||
@@ -306,7 +307,7 @@ func (s *ShBinary) generateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
func (s *ShBinary) GetSubname(ctx android.ModuleContext) string {
|
func (s *ShBinary) GetSubname(ctx android.ModuleContext) string {
|
||||||
ret := ""
|
ret := ""
|
||||||
if s.properties.ImageVariation != "" {
|
if s.properties.ImageVariation != "" {
|
||||||
if s.properties.ImageVariation != cc.VendorVariation {
|
if s.properties.ImageVariation != android.VendorVariation {
|
||||||
ret = "." + s.properties.ImageVariation
|
ret = "." + s.properties.ImageVariation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user