Pass ModulePath to NameInterface
To allow it to validate that the filename equals Android.bp Bug: 65683273 Test: m -j nothing # which runs tests Change-Id: I171dddd102590df558053b615d39c75c00b6ac6e
This commit is contained in:
parent
656870fbca
commit
3c8c3346d2
3 changed files with 15 additions and 9 deletions
10
context.go
10
context.go
|
@ -1284,7 +1284,7 @@ func (c *Context) addModule(module *moduleInfo) []error {
|
|||
}
|
||||
module.group = group
|
||||
namespace, errs := c.nameInterface.NewModule(
|
||||
&moduleCreationContextImpl{c.ModuleDir(module.logicModule)},
|
||||
&namespaceContextImpl{c.ModulePath(module.logicModule)},
|
||||
ModuleGroup{moduleGroup: group},
|
||||
module.logicModule)
|
||||
if len(errs) > 0 {
|
||||
|
@ -2733,9 +2733,13 @@ func (c *Context) ModuleName(logicModule Module) string {
|
|||
return module.Name()
|
||||
}
|
||||
|
||||
func (c *Context) ModuleDir(logicModule Module) string {
|
||||
func (c *Context) ModulePath(logicModule Module) string {
|
||||
module := c.moduleInfo[logicModule]
|
||||
return filepath.Dir(module.relBlueprintsFile)
|
||||
return module.relBlueprintsFile
|
||||
}
|
||||
|
||||
func (c *Context) ModuleDir(logicModule Module) string {
|
||||
return filepath.Dir(c.ModulePath(logicModule))
|
||||
}
|
||||
|
||||
func (c *Context) ModuleSubDir(logicModule Module) string {
|
||||
|
|
|
@ -272,7 +272,9 @@ func (d *baseModuleContext) Fs() pathtools.FileSystem {
|
|||
}
|
||||
|
||||
func (d *baseModuleContext) Namespace() Namespace {
|
||||
return d.context.nameInterface.GetNamespace(d)
|
||||
nsctx := &namespaceContextImpl{d.context.ModulePath(d.module.logicModule)}
|
||||
|
||||
return d.context.nameInterface.GetNamespace(nsctx)
|
||||
}
|
||||
|
||||
var _ ModuleContext = (*moduleContext)(nil)
|
||||
|
|
|
@ -74,15 +74,15 @@ type NameInterface interface {
|
|||
// A NamespaceContext stores the information given to a NameInterface to enable the NameInterface
|
||||
// to choose the namespace for any given module
|
||||
type NamespaceContext interface {
|
||||
ModuleDir() string
|
||||
ModulePath() string
|
||||
}
|
||||
|
||||
type moduleCreationContextImpl struct {
|
||||
moduleDir string
|
||||
type namespaceContextImpl struct {
|
||||
modulePath string
|
||||
}
|
||||
|
||||
func (ctx *moduleCreationContextImpl) ModuleDir() string {
|
||||
return ctx.moduleDir
|
||||
func (ctx *namespaceContextImpl) ModulePath() string {
|
||||
return ctx.modulePath
|
||||
}
|
||||
|
||||
// a SimpleNameInterface just stores all modules in a map based on name
|
||||
|
|
Loading…
Reference in a new issue