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
diff --git a/android/image.go b/android/image.go
index 9cad056..c278dcd 100644
--- a/android/image.go
+++ b/android/image.go
@@ -19,6 +19,12 @@
// ImageMutatorBegin is called before any other method in the ImageInterface.
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(ctx BaseModuleContext) bool
@@ -49,6 +55,14 @@
}
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
// SDK libraries. (which framework-private libraries can use), which
// will be installed to the system image.
@@ -94,6 +108,12 @@
if m.RecoveryVariantNeeded(ctx) {
variations = append(variations, RecoveryVariation)
}
+ if m.VendorVariantNeeded(ctx) {
+ variations = append(variations, VendorVariation)
+ }
+ if m.ProductVariantNeeded(ctx) {
+ variations = append(variations, ProductVariation)
+ }
extraVariations := m.ExtraImageVariations(ctx)
variations = append(variations, extraVariations...)