aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-05-25 01:01:15 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-05-25 01:01:15 +0000
commit547f2e92391adbc5c6626e826fa2014eb42ae00d (patch)
treee1ba8c01ad13d485e97071294f90ca3be9c1c531
parentd7f731f1a892cfa001a69f65d371b9dc2266ad69 (diff)
parenta90cba820b6b51ee23a404d048600b4816f8773b (diff)
downloadblueprint-android12-d1-release.tar.gz
Change-Id: I8f6000c809bd9b4a3482d87e95479e9ccb6ed8eb
-rw-r--r--context.go8
-rw-r--r--module_ctx.go7
2 files changed, 10 insertions, 5 deletions
diff --git a/context.go b/context.go
index f55b4b6..e891c23 100644
--- a/context.go
+++ b/context.go
@@ -747,6 +747,7 @@ func (c *Context) ParseFileList(rootDir string, filePaths []string,
type newModuleInfo struct {
*moduleInfo
+ deps []string
added chan<- struct{}
}
@@ -772,12 +773,12 @@ func (c *Context) ParseFileList(rootDir string, filePaths []string,
// registered by name. This allows load hooks to set and/or modify any aspect
// of the module (including names) using information that is not available when
// the module factory is called.
- newModules, errs := runAndRemoveLoadHooks(c, config, module, &scopedModuleFactories)
+ newModules, newDeps, errs := runAndRemoveLoadHooks(c, config, module, &scopedModuleFactories)
if len(errs) > 0 {
return errs
}
- moduleCh <- newModuleInfo{module, addedCh}
+ moduleCh <- newModuleInfo{module, newDeps, addedCh}
<-addedCh
for _, n := range newModules {
errs = addModule(n)
@@ -820,6 +821,7 @@ func (c *Context) ParseFileList(rootDir string, filePaths []string,
doneCh <- struct{}{}
}()
+ var hookDeps []string
loop:
for {
select {
@@ -827,6 +829,7 @@ loop:
errs = append(errs, newErrs...)
case module := <-moduleCh:
newErrs := c.addModule(module.moduleInfo)
+ hookDeps = append(hookDeps, module.deps...)
if module.added != nil {
module.added <- struct{}{}
}
@@ -841,6 +844,7 @@ loop:
}
}
+ deps = append(deps, hookDeps...)
return deps, errs
}
diff --git a/module_ctx.go b/module_ctx.go
index 7e8acf6..a074e37 100644
--- a/module_ctx.go
+++ b/module_ctx.go
@@ -1339,7 +1339,7 @@ func AddLoadHook(module Module, hook LoadHook) {
}
func runAndRemoveLoadHooks(ctx *Context, config interface{}, module *moduleInfo,
- scopedModuleFactories *map[string]ModuleFactory) (newModules []*moduleInfo, errs []error) {
+ scopedModuleFactories *map[string]ModuleFactory) (newModules []*moduleInfo, deps []string, errs []error) {
if v, exists := pendingHooks.Load(module.logicModule); exists {
hooks := v.(*[]LoadHook)
@@ -1355,14 +1355,15 @@ func runAndRemoveLoadHooks(ctx *Context, config interface{}, module *moduleInfo,
for _, hook := range *hooks {
hook(mctx)
newModules = append(newModules, mctx.newModules...)
+ deps = append(deps, mctx.ninjaFileDeps...)
errs = append(errs, mctx.errs...)
}
pendingHooks.Delete(module.logicModule)
- return newModules, errs
+ return newModules, deps, errs
}
- return nil, nil
+ return nil, nil, nil
}
// Check the syntax of a generated blueprint file.