From 1455a0f7b18a93386942b3b7519efe9f95d09e3d Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 17 Dec 2014 13:23:56 -0800 Subject: [PATCH] Remove pregenerate pass PreGenerateBuildActions is no longer used by the build logic, remove it. Change-Id: I621c26e796d2bf6cdc587770a8f9572a769bc705 --- blueprint/context.go | 45 ++++++----------------------------------- blueprint/module_ctx.go | 39 ++++++++++------------------------- 2 files changed, 17 insertions(+), 67 deletions(-) diff --git a/blueprint/context.go b/blueprint/context.go index 7a508cb..28f8821 100644 --- a/blueprint/context.go +++ b/blueprint/context.go @@ -1014,11 +1014,6 @@ func (c *Context) PrepareBuildActions(config interface{}) (deps []string, errs [ c.initSpecialVariables() - errs = c.preGenerateModuleBuildActions(config) - if len(errs) > 0 { - return nil, errs - } - depsModules, errs := c.generateModuleBuildActions(config, liveGlobals) if len(errs) > 0 { return nil, errs @@ -1158,32 +1153,6 @@ func (c *Context) initSpecialVariables() { c.requiredNinjaMicro = 0 } -func (c *Context) preGenerateModuleBuildActions(config interface{}) (errs []error) { - for _, group := range c.moduleGroupsSorted { - for _, module := range group.modules { - if preGenerateModule, ok := module.logicModule.(preGenerateModule); ok { - mctx := &preModuleContext{ - baseModuleContext: baseModuleContext{ - context: c, - config: config, - group: group, - }, - module: module, - } - - preGenerateModule.PreGenerateBuildActions(mctx) - - if len(mctx.errs) > 0 { - errs = append(errs, mctx.errs...) - break - } - } - } - } - - return -} - func (c *Context) generateModuleBuildActions(config interface{}, liveGlobals *liveTracker) ([]string, []error) { @@ -1198,15 +1167,13 @@ func (c *Context) generateModuleBuildActions(config interface{}, for _, module := range group.modules { mctx := &moduleContext{ - preModuleContext: preModuleContext{ - baseModuleContext: baseModuleContext{ - context: c, - config: config, - group: group, - }, - module: module, + baseModuleContext: baseModuleContext{ + context: c, + config: config, + group: group, }, - scope: scope, + module: module, + scope: scope, } mctx.module.logicModule.GenerateBuildActions(mctx) diff --git a/blueprint/module_ctx.go b/blueprint/module_ctx.go index 6faff01..e2c68f2 100644 --- a/blueprint/module_ctx.go +++ b/blueprint/module_ctx.go @@ -68,13 +68,6 @@ type Module interface { GenerateBuildActions(ModuleContext) } -type preGenerateModule interface { - // PreGenerateBuildActions is called by the Context that created the Module - // during its generate phase, before calling GenerateBuildActions on - // any module. It should not touch any Ninja build actions. - PreGenerateBuildActions(PreModuleContext) -} - // A DynamicDependerModule is a Module that may add dependencies that do not // appear in its "deps" property. Any Module that implements this interface // will have its DynamicDependencies method called by the Context that created @@ -106,7 +99,7 @@ type DynamicDependerModuleContext interface { BaseModuleContext } -type PreModuleContext interface { +type ModuleContext interface { BaseModuleContext OtherModuleName(m Module) string @@ -114,10 +107,6 @@ type PreModuleContext interface { VisitDepsDepthFirst(visit func(Module)) VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module)) -} - -type ModuleContext interface { - PreModuleContext ModuleSubDir() string @@ -194,19 +183,22 @@ func (d *baseModuleContext) Failed() bool { return len(d.errs) > 0 } -var _ PreModuleContext = (*preModuleContext)(nil) +var _ ModuleContext = (*moduleContext)(nil) -type preModuleContext struct { +type moduleContext struct { baseModuleContext - module *moduleInfo + module *moduleInfo + scope *localScope + ninjaFileDeps []string + actionDefs localBuildActions } -func (m *preModuleContext) OtherModuleName(module Module) string { +func (m *moduleContext) OtherModuleName(module Module) string { info := m.context.moduleInfo[module] return info.group.properties.Name } -func (m *preModuleContext) OtherModuleErrorf(module Module, format string, +func (m *moduleContext) OtherModuleErrorf(module Module, format string, args ...interface{}) { info := m.context.moduleInfo[module] @@ -216,25 +208,16 @@ func (m *preModuleContext) OtherModuleErrorf(module Module, format string, }) } -func (m *preModuleContext) VisitDepsDepthFirst(visit func(Module)) { +func (m *moduleContext) VisitDepsDepthFirst(visit func(Module)) { m.context.visitDepsDepthFirst(m.module, visit) } -func (m *preModuleContext) VisitDepsDepthFirstIf(pred func(Module) bool, +func (m *moduleContext) VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module)) { m.context.visitDepsDepthFirstIf(m.module, pred, visit) } -var _ ModuleContext = (*moduleContext)(nil) - -type moduleContext struct { - preModuleContext - scope *localScope - ninjaFileDeps []string - actionDefs localBuildActions -} - func (m *moduleContext) ModuleSubDir() string { return m.module.subName() }