Add OtherModuleExists

Allow dependency modifying mutators to check if another module exists
based on its name.  Allows primary builders to have custom handling for
missing-module errors, for example by falling back to another module.

Change-Id: I04ddd66be43c514f1f8928e15b2a79cadebcfc17
This commit is contained in:
Colin Cross 2016-05-17 17:37:16 -07:00
parent 0b7e83e11a
commit b3f96c3306

View file

@ -456,6 +456,7 @@ type mutatorContext struct {
type baseMutatorContext interface {
BaseModuleContext
OtherModuleExists(name string) bool
Module() Module
}
@ -651,6 +652,10 @@ func (mctx *mutatorContext) AddInterVariantDependency(tag DependencyTag, from, t
mctx.context.addInterVariantDependency(mctx.module, tag, from, to)
}
func (mctx *mutatorContext) OtherModuleExists(name string) bool {
return mctx.context.moduleNames[name] != nil
}
// SimpleName is an embeddable object to implement the ModuleContext.Name method using a property
// called "name". Modules that embed it must also add SimpleName.Properties to their property
// structure list.