diff options
author | 2020-07-02 11:38:17 -0700 | |
---|---|---|
committer | 2020-09-17 18:57:03 -0700 | |
commit | d27e7b8e459b3ed89763c910bf97b40512cf5b40 (patch) | |
tree | b2fc7e5ee1d6187691c109c24c25ae63a2d59206 /android/module.go | |
parent | d1f898e70abf0e750ae351689a6291700ff8739c (diff) |
Add providers support
Propagate the providers methods from
https://github.com/google/blueprint/pull/309 to Soong.
Test: m checkbuild
Change-Id: Iad7a9023df4421cd01dbb0518be0e85382097481
Diffstat (limited to 'android/module.go')
-rw-r--r-- | android/module.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/android/module.go b/android/module.go index 1424f7694..9868c04ef 100644 --- a/android/module.go +++ b/android/module.go @@ -176,6 +176,31 @@ type BaseModuleContext interface { // It is intended for use inside the visit functions of Visit* and WalkDeps. OtherModuleType(m blueprint.Module) string + // OtherModuleProvider returns the value for a provider for the given module. If the value is + // not set it returns the zero value of the type of the provider, so the return value can always + // be type asserted to the type of the provider. The value returned may be a deep copy of the + // value originally passed to SetProvider. + OtherModuleProvider(m blueprint.Module, provider blueprint.ProviderKey) interface{} + + // OtherModuleHasProvider returns true if the provider for the given module has been set. + OtherModuleHasProvider(m blueprint.Module, provider blueprint.ProviderKey) bool + + // Provider returns the value for a provider for the current module. If the value is + // not set it returns the zero value of the type of the provider, so the return value can always + // be type asserted to the type of the provider. It panics if called before the appropriate + // mutator or GenerateBuildActions pass for the provider. The value returned may be a deep + // copy of the value originally passed to SetProvider. + Provider(provider blueprint.ProviderKey) interface{} + + // HasProvider returns true if the provider for the current module has been set. + HasProvider(provider blueprint.ProviderKey) bool + + // SetProvider sets the value for a provider for the current module. It panics if not called + // during the appropriate mutator or GenerateBuildActions pass for the provider, if the value + // is not of the appropriate type, or if the value has already been set. The value should not + // be modified after being passed to SetProvider. + SetProvider(provider blueprint.ProviderKey, value interface{}) + GetDirectDepsWithTag(tag blueprint.DependencyTag) []Module // GetDirectDepWithTag returns the Module the direct dependency with the specified name, or nil if @@ -1667,6 +1692,21 @@ func (b *baseModuleContext) OtherModuleReverseDependencyVariantExists(name strin func (b *baseModuleContext) OtherModuleType(m blueprint.Module) string { return b.bp.OtherModuleType(m) } +func (b *baseModuleContext) OtherModuleProvider(m blueprint.Module, provider blueprint.ProviderKey) interface{} { + return b.bp.OtherModuleProvider(m, provider) +} +func (b *baseModuleContext) OtherModuleHasProvider(m blueprint.Module, provider blueprint.ProviderKey) bool { + return b.bp.OtherModuleHasProvider(m, provider) +} +func (b *baseModuleContext) Provider(provider blueprint.ProviderKey) interface{} { + return b.bp.Provider(provider) +} +func (b *baseModuleContext) HasProvider(provider blueprint.ProviderKey) bool { + return b.bp.HasProvider(provider) +} +func (b *baseModuleContext) SetProvider(provider blueprint.ProviderKey, value interface{}) { + b.bp.SetProvider(provider, value) +} func (b *baseModuleContext) GetDirectDepWithTag(name string, tag blueprint.DependencyTag) blueprint.Module { return b.bp.GetDirectDepWithTag(name, tag) |