aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2019-03-01 13:43:09 -0800
committerColin Cross <ccross@android.com>2019-03-01 13:44:15 -0800
commitd28b304d30eb34a1167c92edcccfb913763dfde9 (patch)
tree315b79b737723bacc4654343b1dc8cfe3147cf0b
parentbf8c1d31d9cb9ade9efa50ccbe6ae5bb7c1eb343 (diff)
downloadblueprint-d28b304d30eb34a1167c92edcccfb913763dfde9.tar.gz
Add more OtherModule* methods
Add OtherModuleDir, OtherModuleSubDir, and OtherModuleType to ModuleContext and TopDownMutatorContext, and add ModuleType to BaseModuleContext. Change-Id: If5c873a2620ef10333c0bdba5ab89d4256e5fdf2
-rw-r--r--module_ctx.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/module_ctx.go b/module_ctx.go
index 9dbf43d..d127c0e 100644
--- a/module_ctx.go
+++ b/module_ctx.go
@@ -123,6 +123,7 @@ type DynamicDependerModule interface {
type BaseModuleContext interface {
ModuleName() string
ModuleDir() string
+ ModuleType() string
Config() interface{}
ContainsProperty(name string) bool
@@ -154,6 +155,9 @@ type ModuleContext interface {
BaseModuleContext
OtherModuleName(m Module) string
+ OtherModuleDir(m Module) string
+ OtherModuleSubDir(m Module) string
+ OtherModuleType(m Module) string
OtherModuleErrorf(m Module, fmt string, args ...interface{})
OtherModuleDependencyTag(m Module) DependencyTag
@@ -199,6 +203,10 @@ func (d *baseModuleContext) ModuleName() string {
return d.module.Name()
}
+func (d *baseModuleContext) ModuleType() string {
+ return d.module.typeName
+}
+
func (d *baseModuleContext) ContainsProperty(name string) bool {
_, ok := d.module.propertyPos[name]
return ok
@@ -291,6 +299,21 @@ func (m *baseModuleContext) OtherModuleName(logicModule Module) string {
return module.Name()
}
+func (m *baseModuleContext) OtherModuleDir(logicModule Module) string {
+ module := m.context.moduleInfo[logicModule]
+ return filepath.Dir(module.relBlueprintsFile)
+}
+
+func (m *baseModuleContext) OtherModuleSubDir(logicModule Module) string {
+ module := m.context.moduleInfo[logicModule]
+ return module.variantName
+}
+
+func (m *baseModuleContext) OtherModuleType(logicModule Module) string {
+ module := m.context.moduleInfo[logicModule]
+ return module.typeName
+}
+
func (m *baseModuleContext) OtherModuleErrorf(logicModule Module, format string,
args ...interface{}) {
@@ -559,6 +582,9 @@ type TopDownMutatorContext interface {
baseMutatorContext
OtherModuleName(m Module) string
+ OtherModuleDir(m Module) string
+ OtherModuleSubDir(m Module) string
+ OtherModuleType(m Module) string
OtherModuleErrorf(m Module, fmt string, args ...interface{})
OtherModuleDependencyTag(m Module) DependencyTag