diff options
Diffstat (limited to 'android/module.go')
-rw-r--r-- | android/module.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/android/module.go b/android/module.go index 82b37818e..e3682fa30 100644 --- a/android/module.go +++ b/android/module.go @@ -1803,6 +1803,26 @@ type FinalModuleBuildTargetsInfo struct { var FinalModuleBuildTargetsProvider = blueprint.NewProvider[FinalModuleBuildTargetsInfo]() +type CommonPropertiesProviderData struct { + Enabled bool + // Whether the module has been replaced by a prebuilt + ReplacedByPrebuilt bool +} + +var CommonPropertiesProviderKey = blueprint.NewProvider[CommonPropertiesProviderData]() + +type PrebuiltModuleProviderData struct { + // Empty for now +} + +var PrebuiltModuleProviderKey = blueprint.NewProvider[PrebuiltModuleProviderData]() + +type HostToolProviderData struct { + HostToolPath OptionalPath +} + +var HostToolProviderKey = blueprint.NewProvider[HostToolProviderData]() + func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) { ctx := &moduleContext{ module: m.module, @@ -2048,6 +2068,23 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) }) } buildComplianceMetadataProvider(ctx, m) + + commonData := CommonPropertiesProviderData{ + ReplacedByPrebuilt: m.commonProperties.ReplacedByPrebuilt, + } + if m.commonProperties.ForcedDisabled { + commonData.Enabled = false + } else { + commonData.Enabled = m.commonProperties.Enabled.GetOrDefault(m.ConfigurableEvaluator(ctx), !m.Os().DefaultDisabled) + } + SetProvider(ctx, CommonPropertiesProviderKey, commonData) + if p, ok := m.module.(PrebuiltInterface); ok && p.Prebuilt() != nil { + SetProvider(ctx, PrebuiltModuleProviderKey, PrebuiltModuleProviderData{}) + } + if h, ok := m.module.(HostToolProvider); ok { + SetProvider(ctx, HostToolProviderKey, HostToolProviderData{ + HostToolPath: h.HostToolPath()}) + } } func SetJarJarPrefixHandler(handler func(ModuleContext)) { |