summaryrefslogtreecommitdiff
path: root/sh/sh_binary.go
diff options
context:
space:
mode:
author Jihoon Kang <jihoonkang@google.com> 2024-06-19 00:51:16 +0000
committer Jihoon Kang <jihoonkang@google.com> 2024-06-21 07:45:09 +0000
commit47e918450f83fc5f2680c0a3f7d6d1209e031e7c (patch)
treec221fbc8fe3494e55dd25259b272e966644373dd /sh/sh_binary.go
parent25cdff6815b51cf78ca433bccd5ba3165d26d41b (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 'sh/sh_binary.go')
-rw-r--r--sh/sh_binary.go19
1 files changed, 10 insertions, 9 deletions
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
}
}