diff options
author | 2024-06-19 00:51:16 +0000 | |
---|---|---|
committer | 2024-06-21 07:45:09 +0000 | |
commit | 47e918450f83fc5f2680c0a3f7d6d1209e031e7c (patch) | |
tree | c221fbc8fe3494e55dd25259b272e966644373dd /rust/image.go | |
parent | 25cdff6815b51cf78ca433bccd5ba3165d26d41b (diff) |
Move vendor and product variant generation logic from cc package to android package
Although image variation generation logic has moved out of cc package to
the android package, the vendor and product partition variants
generation logic is still specific to cc package. Therefore, in order to
create a product or vendor variant, they have to specified in
`ExtraImageVariants`. In order to avoid such confusing behaviors and
enforce modules to specify product and vendor installation rules, this
change moves the vendor and product variant generation logic to
android.ImageInterface.
Test: m nothing --no-skip-soong-tests && diff contents of out/soong/Android-{product}.mk
Change-Id: I9e14f3739d9dea94167ee6a91e92b2f942055aba
Diffstat (limited to 'rust/image.go')
-rw-r--r-- | rust/image.go | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/rust/image.go b/rust/image.go index fec6d92d8..26929b1ac 100644 --- a/rust/image.go +++ b/rust/image.go @@ -77,6 +77,14 @@ func (mod *Module) SetCoreVariantNeeded(b bool) { 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 { if snapshot, ok := mod.compiler.(cc.SnapshotInterface); ok { 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 { return mod.Properties.VendorRamdiskVariantNeeded } @@ -184,12 +200,12 @@ func (mod *Module) HasNonSystemVariants() 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 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. @@ -202,13 +218,13 @@ func (mod *Module) SetImageVariation(ctx android.BaseModuleContext, variant stri mod.MakeAsPlatform() } else if variant == android.RecoveryVariation { mod.MakeAsPlatform() - } else if strings.HasPrefix(variant, cc.VendorVariation) { - mod.Properties.ImageVariation = cc.VendorVariation + } else if strings.HasPrefix(variant, android.VendorVariation) { + mod.Properties.ImageVariation = android.VendorVariation if strings.HasPrefix(variant, cc.VendorVariationPrefix) { mod.Properties.VndkVersion = strings.TrimPrefix(variant, cc.VendorVariationPrefix) } - } else if strings.HasPrefix(variant, cc.ProductVariation) { - mod.Properties.ImageVariation = cc.ProductVariation + } else if strings.HasPrefix(variant, android.ProductVariation) { + mod.Properties.ImageVariation = android.ProductVariation if strings.HasPrefix(variant, cc.ProductVariationPrefix) { mod.Properties.VndkVersion = strings.TrimPrefix(variant, cc.ProductVariationPrefix) } |