Pass StopBefore as an argument to RunBlueprint. am: a9768e1ad7 am: d77170912f am: 9ac1235e62

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

Change-Id: Ia73be93912d12ff8246ee15e873285700999abeb
This commit is contained in:
Lukacs T. Berki 2021-09-08 07:07:28 +00:00 committed by Automerger Merge Worker
commit a988f811d5
2 changed files with 6 additions and 13 deletions

View file

@ -78,7 +78,7 @@ func PrimaryBuilderExtraFlags(args Args, mainNinjaFile string) []string {
// Returns the list of dependencies the emitted Ninja files has. These can be // Returns the list of dependencies the emitted Ninja files has. These can be
// written to the .d file for the output so that it is correctly rebuilt when // written to the .d file for the output so that it is correctly rebuilt when
// needed in case Blueprint is itself invoked from Ninja // needed in case Blueprint is itself invoked from Ninja
func RunBlueprint(args Args, ctx *blueprint.Context, config interface{}) []string { func RunBlueprint(args Args, stopBefore StopBefore, ctx *blueprint.Context, config interface{}) []string {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())
if args.NoGC { if args.NoGC {
@ -139,11 +139,9 @@ func RunBlueprint(args Args, ctx *blueprint.Context, config interface{}) []strin
} }
ninjaDeps = append(ninjaDeps, extraDeps...) ninjaDeps = append(ninjaDeps, extraDeps...)
if c, ok := config.(ConfigStopBefore); ok { if stopBefore == StopBeforePrepareBuildActions {
if c.StopBefore() == StopBeforePrepareBuildActions {
return ninjaDeps return ninjaDeps
} }
}
extraDeps, errs = ctx.PrepareBuildActions(config) extraDeps, errs = ctx.PrepareBuildActions(config)
if len(errs) > 0 { if len(errs) > 0 {
@ -151,11 +149,9 @@ func RunBlueprint(args Args, ctx *blueprint.Context, config interface{}) []strin
} }
ninjaDeps = append(ninjaDeps, extraDeps...) ninjaDeps = append(ninjaDeps, extraDeps...)
if c, ok := config.(ConfigStopBefore); ok { if stopBefore == StopBeforeWriteNinja {
if c.StopBefore() == StopBeforeWriteNinja {
return ninjaDeps return ninjaDeps
} }
}
const outFilePermissions = 0666 const outFilePermissions = 0666
var out io.StringWriter var out io.StringWriter

View file

@ -102,14 +102,11 @@ type BootstrapConfig interface {
type StopBefore int type StopBefore int
const ( const (
DoEverything StopBefore = 0
StopBeforePrepareBuildActions StopBefore = 1 StopBeforePrepareBuildActions StopBefore = 1
StopBeforeWriteNinja StopBefore = 2 StopBeforeWriteNinja StopBefore = 2
) )
type ConfigStopBefore interface {
StopBefore() StopBefore
}
type PrimaryBuilderInvocation struct { type PrimaryBuilderInvocation struct {
Inputs []string Inputs []string
Outputs []string Outputs []string