diff options
Diffstat (limited to 'bootstrap/command.go')
-rw-r--r-- | bootstrap/command.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/bootstrap/command.go b/bootstrap/command.go index ad8b263..0c0fbe7 100644 --- a/bootstrap/command.go +++ b/bootstrap/command.go @@ -40,13 +40,15 @@ var ( runGoTests bool noGC bool - BuildDir string - SrcDir string + BuildDir string + NinjaBuildDir string + SrcDir string ) func init() { flag.StringVar(&outFile, "o", "build.ninja", "the Ninja file to output") flag.StringVar(&BuildDir, "b", ".", "the build output directory") + flag.StringVar(&NinjaBuildDir, "n", "", "the ninja builddir directory") flag.StringVar(&depFile, "d", "", "the dependency file to output") flag.StringVar(&docFile, "docs", "", "build documentation file to output") flag.StringVar(&cpuprofile, "cpuprofile", "", "write cpu profile to file") @@ -91,6 +93,10 @@ func Main(ctx *blueprint.Context, config interface{}, extraNinjaFileDeps ...stri fatalf("no Blueprints file specified") } + if NinjaBuildDir == "" { + NinjaBuildDir = BuildDir + } + SrcDir = filepath.Dir(flag.Arg(0)) stage := StageMain @@ -160,8 +166,9 @@ func Main(ctx *blueprint.Context, config interface{}, extraNinjaFileDeps ...stri } } - if c, ok := config.(ConfigRemoveAbandonedFiles); !ok || c.RemoveAbandonedFiles() { - err := removeAbandonedFiles(ctx, bootstrapConfig, SrcDir) + if c, ok := config.(ConfigRemoveAbandonedFilesUnder); ok { + under := c.RemoveAbandonedFilesUnder() + err := removeAbandonedFilesUnder(ctx, bootstrapConfig, SrcDir, under) if err != nil { fatalf("error removing abandoned files: %s", err) } |