Require ninja 1.6.0, remove workaround

The workaround no longer works with the new stage selector. We may run
bootstrap.ninja.in twice before running the next stage, but we can't
encode whether to run another ninja instance in the checked in
build.ninja.in.

This can likely be solved, but now that there's an official release with
support for multiple passes, just push up the required version.

Change-Id: I76e321912e323d60e462aabec61bdfcc7118cd5e
diff --git a/bootstrap/bootstrap.go b/bootstrap/bootstrap.go
index c07f863..1b6d4e7 100644
--- a/bootstrap/bootstrap.go
+++ b/bootstrap/bootstrap.go
@@ -16,9 +16,7 @@
 
 import (
 	"fmt"
-	"os"
 	"path/filepath"
-	"strconv"
 	"strings"
 
 	"github.com/google/blueprint"
@@ -34,28 +32,6 @@
 	linkCmd       = pctx.StaticVariable("linkCmd", "$goToolDir/${goChar}l")
 	goTestMainCmd = pctx.StaticVariable("goTestMainCmd", filepath.Join(bootstrapDir, "bin", "gotestmain"))
 
-	// Ninja only reinvokes itself once when it regenerates a .ninja file. For
-	// the re-bootstrap process we need that to happen more than once, so we
-	// invoke an additional Ninja process from the rebootstrap rule.
-	// Unfortunately this seems to cause "warning: bad deps log signature or
-	// version; starting over" messages from Ninja. This warning can be
-	// avoided by having the bootstrap and non-bootstrap build manifests have
-	// a different builddir (so they use different log files).
-	//
-	// This workaround can be avoided entirely by making a simple change to
-	// Ninja that would allow it to rebuild the manifest multiple times rather
-	// than just once.  If the Ninja being used is capable of this, then the
-	// workaround we're doing can be disabled by setting the
-	// BLUEPRINT_NINJA_HAS_MULTIPASS environment variable to a true value.
-	runChildNinja = pctx.VariableFunc("runChildNinja",
-		func(config interface{}) (string, error) {
-			if ninjaHasMultipass(config) {
-				return "", nil
-			} else {
-				return " && ninja", nil
-			}
-		})
-
 	gc = pctx.StaticRule("gc",
 		blueprint.RuleParams{
 			Command: "GOROOT='$goRoot' $gcCmd -o $out -p $pkgPath -complete " +
@@ -99,13 +75,6 @@
 			Generator:   true,
 		})
 
-	rebootstrap = pctx.StaticRule("rebootstrap",
-		blueprint.RuleParams{
-			Command:     "$bootstrapCmd -i $in$runChildNinja",
-			Description: "re-bootstrap $in",
-			Generator:   true,
-		})
-
 	// Work around a Ninja issue.  See https://github.com/martine/ninja/pull/634
 	phony = pctx.StaticRule("phony",
 		blueprint.RuleParams{
@@ -151,17 +120,6 @@
 	return isBinary
 }
 
-// ninjaHasMultipass returns true if Ninja will perform multiple passes
-// that can regenerate the build manifest.
-func ninjaHasMultipass(config interface{}) bool {
-	envString := os.Getenv("BLUEPRINT_NINJA_HAS_MULTIPASS")
-	envValue, err := strconv.ParseBool(envString)
-	if err != nil {
-		return false
-	}
-	return envValue
-}
-
 // A goPackage is a module for building Go packages.
 type goPackage struct {
 	properties struct {
@@ -563,11 +521,8 @@
 		// We're generating a bootstrapper Ninja file, so we need to set things
 		// up to rebuild the build.ninja file using the primary builder.
 
-		// Because the non-bootstrap build.ninja file manually re-invokes Ninja,
-		// its builddir must be different than that of the bootstrap build.ninja
-		// file.  Otherwise we occasionally get "warning: bad deps log signature
-		// or version; starting over" messages from Ninja, presumably because
-		// two Ninja processes try to write to the same log concurrently.
+		// BuildDir must be different between bootstrap and the main build,
+		// otherwise the cleanup process will remove files from the other build.
 		ctx.SetBuildDir(pctx, bootstrapDir)
 
 		// Generate build system docs for the primary builder.  Generating docs reads the source
@@ -687,7 +642,7 @@
 		buildNinjaDeps = append(buildNinjaDeps, rebootstrapDeps...)
 
 		ctx.Build(pctx, blueprint.BuildParams{
-			Rule:      rebootstrap,
+			Rule:      bootstrap,
 			Outputs:   []string{"build.ninja"},
 			Inputs:    []string{"$bootstrapManifest"},
 			Implicits: buildNinjaDeps,
diff --git a/build.ninja.in b/build.ninja.in
index 3f43e21..0bc9450 100644
--- a/build.ninja.in
+++ b/build.ninja.in
@@ -7,7 +7,7 @@
 #
 #     bootstrap [from Go package github.com/google/blueprint/bootstrap]
 #
-ninja_required_version = 1.1.0
+ninja_required_version = 1.6.0
 
 g.bootstrap.bootstrapCmd = @@Bootstrap@@
 
@@ -52,7 +52,7 @@
 # Module:  blueprint
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·001
 # Defined: Blueprints:1:1
 
 build .bootstrap/blueprint/pkg/github.com/google/blueprint.a: g.bootstrap.gc $
@@ -75,7 +75,7 @@
 # Module:  blueprint-bootstrap
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·001
 # Defined: Blueprints:70:1
 
 build $
@@ -101,7 +101,7 @@
 # Module:  blueprint-bootstrap-bpdoc
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·001
 # Defined: Blueprints:89:1
 
 build $
@@ -121,7 +121,7 @@
 # Module:  blueprint-deptools
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·001
 # Defined: Blueprints:46:1
 
 build .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
@@ -135,7 +135,7 @@
 # Module:  blueprint-parser
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·001
 # Defined: Blueprints:31:1
 
 build .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a: $
@@ -150,7 +150,7 @@
 # Module:  blueprint-pathtools
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·001
 # Defined: Blueprints:52:1
 
 build $
@@ -165,7 +165,7 @@
 # Module:  blueprint-proptools
 # Variant:
 # Type:    bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.func·002
+# Factory: github.com/google/blueprint/bootstrap.func·001
 # Defined: Blueprints:64:1
 
 build $
@@ -180,7 +180,7 @@
 # Module:  bpfmt
 # Variant:
 # Type:    bootstrap_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
+# Factory: github.com/google/blueprint/bootstrap.func·002
 # Defined: Blueprints:110:1
 
 build .bootstrap/bpfmt/obj/bpfmt.a: g.bootstrap.gc $
@@ -202,7 +202,7 @@
 # Module:  bpmodify
 # Variant:
 # Type:    bootstrap_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
+# Factory: github.com/google/blueprint/bootstrap.func·002
 # Defined: Blueprints:116:1
 
 build .bootstrap/bpmodify/obj/bpmodify.a: g.bootstrap.gc $
@@ -224,7 +224,7 @@
 # Module:  gotestmain
 # Variant:
 # Type:    bootstrap_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
+# Factory: github.com/google/blueprint/bootstrap.func·002
 # Defined: Blueprints:122:1
 
 build .bootstrap/gotestmain/obj/gotestmain.a: g.bootstrap.gc $
@@ -243,7 +243,7 @@
 # Module:  minibp
 # Variant:
 # Type:    bootstrap_go_binary
-# Factory: github.com/google/blueprint/bootstrap.func·003
+# Factory: github.com/google/blueprint/bootstrap.func·002
 # Defined: Blueprints:101:1
 
 build .bootstrap/minibp/obj/minibp.a: g.bootstrap.gc $
@@ -269,7 +269,7 @@
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Singleton: bootstrap
-# Factory:   github.com/google/blueprint/bootstrap.func·008
+# Factory:   github.com/google/blueprint/bootstrap.func·007
 
 rule s.bootstrap.bigbpDocs
     command = .bootstrap/bin/minibp -p --docs ${out} ${g.bootstrap.srcDir}/Blueprints
diff --git a/context.go b/context.go
index 4794934..0109dd3 100644
--- a/context.go
+++ b/context.go
@@ -1631,7 +1631,7 @@
 func (c *Context) initSpecialVariables() {
 	c.buildDir = nil
 	c.requiredNinjaMajor = 1
-	c.requiredNinjaMinor = 1
+	c.requiredNinjaMinor = 6
 	c.requiredNinjaMicro = 0
 }