aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/command.go
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2017-07-19 22:43:30 -0700
committerDan Willemsen <dwillemsen@google.com>2017-07-24 14:02:51 -0700
commitcd4e0cebc98bcd164238236d871ed7d5284d2b09 (patch)
tree6f74ff79984913e78ea6e19a3f2f8678f4bd43d6 /bootstrap/command.go
parentaf456eaae4a9655a6105d997eba180163849ed49 (diff)
downloadandroid_build_blueprint-cd4e0cebc98bcd164238236d871ed7d5284d2b09.tar.gz
android_build_blueprint-cd4e0cebc98bcd164238236d871ed7d5284d2b09.tar.bz2
android_build_blueprint-cd4e0cebc98bcd164238236d871ed7d5284d2b09.zip
Unify .ninja_log files
Having separate .ninja_log files doesn't work very well after https://github.com/ninja-build/ninja/commit/04d886b11041bb59d01df794cce7a1e8cad2250d since the last successful timestamp is not recorded in the ninja log. This was triggering the primary builder to be run twice on every build since it was always considered out of date in the primary, then main stages. The two bootstrap stages already were unified when minibootstrap was simplified, but this combines the main stage as well. This means that we'll save some time running globs that are shared between minibp and the primary builder as well (subdirs globs). The cleanup code needed to be refactored, since the ninja_log will have entries from the main stage as well. So instead of looking at everything in the ninja log, take a string prefix to limit what we may clean. Change-Id: I8d43168643aa8a0c6c3e48c6101eaa45d174bbe5
Diffstat (limited to 'bootstrap/command.go')
-rw-r--r--bootstrap/command.go15
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)
}