From 47e918450f83fc5f2680c0a3f7d6d1209e031e7c Mon Sep 17 00:00:00 2001 From: Jihoon Kang Date: Wed, 19 Jun 2024 00:51:16 +0000 Subject: 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 --- sh/sh_binary.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'sh/sh_binary.go') diff --git a/sh/sh_binary.go b/sh/sh_binary.go index 48a442de4..2e48d83e6 100644 --- a/sh/sh_binary.go +++ b/sh/sh_binary.go @@ -212,6 +212,14 @@ var _ android.ImageInterface = (*ShBinary)(nil) 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 { 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 { - extraVariations := []string{} - if s.InstallInProduct() { - extraVariations = append(extraVariations, cc.ProductVariation) - } - if s.InstallInVendor() { - extraVariations = append(extraVariations, cc.VendorVariation) - } - return extraVariations + return nil } 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 { ret := "" if s.properties.ImageVariation != "" { - if s.properties.ImageVariation != cc.VendorVariation { + if s.properties.ImageVariation != android.VendorVariation { ret = "." + s.properties.ImageVariation } } -- cgit v1.2.3-59-g8ed1b