Remove pregenerate pass

PreGenerateBuildActions is no longer used by the build logic, remove it.

Change-Id: I621c26e796d2bf6cdc587770a8f9572a769bc705
This commit is contained in:
Colin Cross 2014-12-17 13:23:56 -08:00
parent 80ad04d5f8
commit 1455a0f7b1
2 changed files with 17 additions and 67 deletions

View file

@ -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)

View file

@ -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()
}