diff --git a/bootstrap/command.go b/bootstrap/command.go index 8c045b4..3342bbe 100644 --- a/bootstrap/command.go +++ b/bootstrap/command.go @@ -113,6 +113,13 @@ func RunBlueprint(args Args, stopBefore StopBefore, ctx *blueprint.Context, conf return ninjaDeps } + if ctx.BeforePrepareBuildActionsHook != nil { + err := ctx.BeforePrepareBuildActionsHook() + if err != nil { + fatalErrors([]error{err}) + } + } + extraDeps, errs = ctx.PrepareBuildActions(config) if len(errs) > 0 { fatalErrors(errs) diff --git a/context.go b/context.go index 47b31ae..5d7ba32 100644 --- a/context.go +++ b/context.go @@ -75,6 +75,8 @@ type Context struct { // Used for metrics-related event logging. EventHandler *metrics.EventHandler + BeforePrepareBuildActionsHook func() error + moduleFactories map[string]ModuleFactory nameInterface NameInterface moduleGroups []*moduleGroup @@ -4095,6 +4097,10 @@ func (c *Context) EndEvent(name string) { c.EventHandler.End(name) } +func (c *Context) SetBeforePrepareBuildActionsHook(hookFn func() error) { + c.BeforePrepareBuildActionsHook = hookFn +} + func (c *Context) writeLocalBuildActions(nw *ninjaWriter, defs *localBuildActions) error {