aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbootstrap.bash5
-rw-r--r--bootstrap/bootstrap.go3
-rw-r--r--bootstrap/command.go8
-rw-r--r--bootstrap/config.go1
4 files changed, 17 insertions, 0 deletions
diff --git a/bootstrap.bash b/bootstrap.bash
index c02fe81..08b85b5 100755
--- a/bootstrap.bash
+++ b/bootstrap.bash
@@ -93,6 +93,11 @@ done
# If RUN_TESTS is set, behave like -t was passed in as an option.
[ ! -z "$RUN_TESTS" ] && EXTRA_ARGS="${EXTRA_ARGS} -t"
+# If EMPTY_NINJA_FILE is set, have the primary build write out a 0-byte ninja
+# file instead of a full length one. Useful if you don't plan on executing the
+# build, but want to verify the primary builder execution.
+[ ! -z "$EMPTY_NINJA_FILE" ] && EXTRA_ARGS="${EXTRA_ARGS} --empty-ninja-file"
+
# Allow the caller to pass in a list of module files
if [ -z "${BLUEPRINT_LIST_FILE}" ]; then
BLUEPRINT_LIST_FILE="${BUILDDIR}/.bootstrap/bplist"
diff --git a/bootstrap/bootstrap.go b/bootstrap/bootstrap.go
index ed33f20..3464c0b 100644
--- a/bootstrap/bootstrap.go
+++ b/bootstrap/bootstrap.go
@@ -650,6 +650,9 @@ func (s *singleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
if s.config.moduleListFile != "" {
extraSharedFlagArray = append(extraSharedFlagArray, "-l", s.config.moduleListFile)
}
+ if s.config.emptyNinjaFile {
+ extraSharedFlagArray = append(extraSharedFlagArray, "--empty-ninja-file")
+ }
extraSharedFlagString := strings.Join(extraSharedFlagArray, " ")
var primaryBuilderName, primaryBuilderExtraFlags string
diff --git a/bootstrap/command.go b/bootstrap/command.go
index ac3fd00..da0191b 100644
--- a/bootstrap/command.go
+++ b/bootstrap/command.go
@@ -41,6 +41,7 @@ var (
runGoTests bool
noGC bool
moduleListFile string
+ emptyNinjaFile bool
BuildDir string
NinjaBuildDir string
@@ -60,6 +61,7 @@ func init() {
flag.BoolVar(&noGC, "nogc", false, "turn off GC for debugging")
flag.BoolVar(&runGoTests, "t", false, "build and run go tests during bootstrap")
flag.StringVar(&moduleListFile, "l", "", "file that lists filepaths to parse")
+ flag.BoolVar(&emptyNinjaFile, "empty-ninja-file", false, "write out a 0-byte ninja file")
}
func Main(ctx *blueprint.Context, config interface{}, extraNinjaFileDeps ...string) {
@@ -122,7 +124,9 @@ func Main(ctx *blueprint.Context, config interface{}, extraNinjaFileDeps ...stri
bootstrapConfig := &Config{
stage: stage,
+
topLevelBlueprintsFile: flag.Arg(0),
+ emptyNinjaFile: emptyNinjaFile,
runGoTests: runGoTests,
moduleListFile: moduleListFile,
}
@@ -175,6 +179,10 @@ func Main(ctx *blueprint.Context, config interface{}, extraNinjaFileDeps ...stri
fatalf("error generating Ninja file contents: %s", err)
}
+ if stage == StageMain && emptyNinjaFile {
+ buf.Reset()
+ }
+
const outFilePermissions = 0666
err = ioutil.WriteFile(outFile, buf.Bytes(), outFilePermissions)
if err != nil {
diff --git a/bootstrap/config.go b/bootstrap/config.go
index 790ac4b..0772b0a 100644
--- a/bootstrap/config.go
+++ b/bootstrap/config.go
@@ -105,6 +105,7 @@ type Config struct {
topLevelBlueprintsFile string
+ emptyNinjaFile bool
runGoTests bool
moduleListFile string
}