Merge "Support pre-build-action hook in blueprint" am: df4ad24151 am: 94222dc0f7

Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2094704

Change-Id: Ie7b1a33da013cd7b78f2c22e8a94295f70d0f6b8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Christopher Parsons 2022-05-20 16:15:37 +00:00 committed by Automerger Merge Worker
commit eb83859840
2 changed files with 13 additions and 0 deletions

View file

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

View file

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