diff options
author | Colin Cross <ccross@android.com> | 2020-08-21 14:25:33 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2020-08-21 14:27:34 -0700 |
commit | cc83efbb180d20768e9f334d15dca6c7c39b69d5 (patch) | |
tree | 62eeb9cf713bb60e5b8b14c38b4ec3cb99c506da /sh | |
parent | ec7a91f9fa303e64fa62dbf74b03fcf1f50ca944 (diff) | |
download | soong-cc83efbb180d20768e9f334d15dca6c7c39b69d5.tar.gz |
Create image variations for sh_binary
AddFarVariationDependencies was broken, which allowed apex modules
to depend on sh_binary even though they were requesting an image
variation and sh_binary did not have one. Create image variations
for sh_binary.
Test: TestApexWithShBinary
Change-Id: I1ff35ea9967edafbb7812a5e56667e4385af7e2f
Diffstat (limited to 'sh')
-rw-r--r-- | sh/sh_binary.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sh/sh_binary.go b/sh/sh_binary.go index 217a4e163..f3f4a4aa7 100644 --- a/sh/sh_binary.go +++ b/sh/sh_binary.go @@ -64,6 +64,12 @@ type shBinaryProperties struct { // install symlinks to the binary Symlinks []string `android:"arch_variant"` + + // Make this module available when building for ramdisk. + Ramdisk_available *bool + + // Make this module available when building for recovery. + Recovery_available *bool } type TestProperties struct { @@ -158,6 +164,29 @@ func (s *ShBinary) Symlinks() []string { return s.properties.Symlinks } +var _ android.ImageInterface = (*ShBinary)(nil) + +func (s *ShBinary) ImageMutatorBegin(ctx android.BaseModuleContext) {} + +func (s *ShBinary) CoreVariantNeeded(ctx android.BaseModuleContext) bool { + return !s.ModuleBase.InstallInRecovery() && !s.ModuleBase.InstallInRamdisk() +} + +func (s *ShBinary) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool { + return proptools.Bool(s.properties.Ramdisk_available) || s.ModuleBase.InstallInRamdisk() +} + +func (s *ShBinary) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool { + return proptools.Bool(s.properties.Recovery_available) || s.ModuleBase.InstallInRecovery() +} + +func (s *ShBinary) ExtraImageVariations(ctx android.BaseModuleContext) []string { + return nil +} + +func (s *ShBinary) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) { +} + func (s *ShBinary) generateAndroidBuildActions(ctx android.ModuleContext) { s.sourceFilePath = android.PathForModuleSrc(ctx, proptools.String(s.properties.Src)) filename := proptools.String(s.properties.Filename) |