diff options
Diffstat (limited to 'android/module.go')
-rw-r--r-- | android/module.go | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/android/module.go b/android/module.go index 1026bdfeb..b6363ea23 100644 --- a/android/module.go +++ b/android/module.go @@ -452,6 +452,22 @@ type commonProperties struct { HostOrDeviceSupported HostOrDeviceSupported `blueprint:"mutated"` ArchSpecific bool `blueprint:"mutated"` + // If set to true then a CommonOS variant will be created which will have dependencies + // on all its OsType specific variants. Used by sdk/module_exports to create a snapshot + // that covers all os and architecture variants. + // + // The OsType specific variants can be retrieved by calling + // GetOsSpecificVariantsOfCommonOSVariant + // + // Set at module initialization time by calling InitCommonOSAndroidMultiTargetsArchModule + CreateCommonOSVariant bool `blueprint:"mutated"` + + // If set to true then this variant is the CommonOS variant that has dependencies on its + // OsType specific variants. + // + // Set by osMutator. + CommonOSVariant bool `blueprint:"mutated"` + SkipInstall bool `blueprint:"mutated"` NamespaceExportedToMake bool `blueprint:"mutated"` @@ -584,6 +600,14 @@ func InitAndroidMultiTargetsArchModule(m Module, hod HostOrDeviceSupported, defa m.base().commonProperties.UseTargetVariants = false } +// As InitAndroidMultiTargetsArchModule except it creates an additional CommonOS variant that +// has dependencies on all the OsType specific variants. +func InitCommonOSAndroidMultiTargetsArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib Multilib) { + InitAndroidArchModule(m, hod, defaultMultilib) + m.base().commonProperties.UseTargetVariants = false + m.base().commonProperties.CreateCommonOSVariant = true +} + // A ModuleBase object contains the properties that are common to all Android // modules. It should be included as an anonymous field in every module // struct definition. InitAndroidModule should then be called from the module's @@ -775,6 +799,11 @@ func (m *ModuleBase) ArchSpecific() bool { return m.commonProperties.ArchSpecific } +// True if the current variant is a CommonOS variant, false otherwise. +func (m *ModuleBase) IsCommonOSVariant() bool { + return m.commonProperties.CommonOSVariant +} + func (m *ModuleBase) OsClassSupported() []OsClass { switch m.commonProperties.HostOrDeviceSupported { case HostSupported: @@ -1103,8 +1132,11 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) blueprintCtx.GetMissingDependencies() // For the final GenerateAndroidBuildActions pass, require that all visited dependencies Soong modules and - // are enabled. - ctx.baseModuleContext.strictVisitDeps = true + // are enabled. Unless the module is a CommonOS variant which may have dependencies on disabled variants + // (because the dependencies are added before the modules are disabled). The + // GetOsSpecificVariantsOfCommonOSVariant(...) method will ensure that the disabled variants are + // ignored. + ctx.baseModuleContext.strictVisitDeps = !m.IsCommonOSVariant() if ctx.config.captureBuild { ctx.ruleParams = make(map[blueprint.Rule]blueprint.RuleParams) |