From a9768e1ad7f7db64c6e8a6a16e45db032e0ff568 Mon Sep 17 00:00:00 2001 From: "Lukacs T. Berki" Date: Tue, 7 Sep 2021 17:54:32 +0200 Subject: [PATCH] Pass StopBefore as an argument to RunBlueprint. Its value is a function of the call site, so it doesn't make a lot of sense to plumb it through the configuration. Test: Presubmits. Change-Id: I5081650818664f283ebc5dc04daef90c26759353 --- bootstrap/command.go | 14 +++++--------- bootstrap/config.go | 5 +---- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/bootstrap/command.go b/bootstrap/command.go index 319fd6f..6847236 100644 --- a/bootstrap/command.go +++ b/bootstrap/command.go @@ -78,7 +78,7 @@ func PrimaryBuilderExtraFlags(args Args, mainNinjaFile string) []string { // 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 // 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()) if args.NoGC { @@ -139,10 +139,8 @@ func RunBlueprint(args Args, ctx *blueprint.Context, config interface{}) []strin } ninjaDeps = append(ninjaDeps, extraDeps...) - if c, ok := config.(ConfigStopBefore); ok { - if c.StopBefore() == StopBeforePrepareBuildActions { - return ninjaDeps - } + if stopBefore == StopBeforePrepareBuildActions { + return ninjaDeps } extraDeps, errs = ctx.PrepareBuildActions(config) @@ -151,10 +149,8 @@ func RunBlueprint(args Args, ctx *blueprint.Context, config interface{}) []strin } ninjaDeps = append(ninjaDeps, extraDeps...) - if c, ok := config.(ConfigStopBefore); ok { - if c.StopBefore() == StopBeforeWriteNinja { - return ninjaDeps - } + if stopBefore == StopBeforeWriteNinja { + return ninjaDeps } const outFilePermissions = 0666 diff --git a/bootstrap/config.go b/bootstrap/config.go index bcfdcf9..50bfc16 100644 --- a/bootstrap/config.go +++ b/bootstrap/config.go @@ -102,14 +102,11 @@ type BootstrapConfig interface { type StopBefore int const ( + DoEverything StopBefore = 0 StopBeforePrepareBuildActions StopBefore = 1 StopBeforeWriteNinja StopBefore = 2 ) -type ConfigStopBefore interface { - StopBefore() StopBefore -} - type PrimaryBuilderInvocation struct { Inputs []string Outputs []string