summaryrefslogtreecommitdiff
path: root/cc/genrule.go
diff options
context:
space:
mode:
Diffstat (limited to 'cc/genrule.go')
-rw-r--r--cc/genrule.go48
1 files changed, 44 insertions, 4 deletions
diff --git a/cc/genrule.go b/cc/genrule.go
index e594f4b2f..e74dd4d72 100644
--- a/cc/genrule.go
+++ b/cc/genrule.go
@@ -26,9 +26,6 @@ func init() {
type GenruleExtraProperties struct {
Vendor_available *bool
Recovery_available *bool
-
- // This genrule is for recovery variant
- InRecovery bool `blueprint:"mutated"`
}
// cc_genrule is a genrule that can depend on other cc_* objects.
@@ -37,7 +34,9 @@ type GenruleExtraProperties struct {
func genRuleFactory() android.Module {
module := genrule.NewGenRule()
- module.Extra = &GenruleExtraProperties{}
+ extra := &GenruleExtraProperties{}
+ module.Extra = extra
+ module.ImageInterface = extra
module.AddProperties(module.Extra)
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibBoth)
@@ -46,3 +45,44 @@ func genRuleFactory() android.Module {
return module
}
+
+var _ android.ImageInterface = (*GenruleExtraProperties)(nil)
+
+func (g *GenruleExtraProperties) ImageMutatorBegin(ctx android.BaseModuleContext) {}
+
+func (g *GenruleExtraProperties) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
+ if ctx.DeviceConfig().VndkVersion() == "" {
+ return true
+ }
+
+ return Bool(g.Vendor_available) || !(ctx.SocSpecific() || ctx.DeviceSpecific())
+}
+
+func (g *GenruleExtraProperties) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
+ if Bool(g.Recovery_available) {
+ primaryArch := ctx.Config().DevicePrimaryArchType()
+ moduleArch := ctx.Target().Arch.ArchType
+ return moduleArch == primaryArch
+ }
+ return false
+}
+
+func (g *GenruleExtraProperties) ExtraImageVariations(ctx android.BaseModuleContext) []string {
+ if ctx.DeviceConfig().VndkVersion() == "" {
+ return nil
+ }
+
+ if Bool(g.Vendor_available) || ctx.SocSpecific() || ctx.DeviceSpecific() {
+ var variants []string
+ variants = append(variants, VendorVariationPrefix+ctx.DeviceConfig().PlatformVndkVersion())
+ if vndkVersion := ctx.DeviceConfig().VndkVersion(); vndkVersion != "current" {
+ variants = append(variants, VendorVariationPrefix+vndkVersion)
+ }
+ return variants
+ }
+
+ return nil
+}
+
+func (g *GenruleExtraProperties) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
+}