Ensure bpglob is built early

This matches the change to blueprint's blueprint_impl.bash:
https://github.com/google/blueprint/pull/213

It allows us to run bpglob during the two bootstrap phases, so we're
never running minibp or the primary builder in a later phase than
normal.

Also removes the dependency on out/soong/build.ninja from the main
phase, since it's never generated by the main phase anymore, and is
tripping the dangling dependency checks.

Bug: 73646380
Test: m nothing
Test: rm frameworks/base/core/java/android/content/pm/dex/ArtManager.java
Test: m nothing   (soong re-runs)
Change-Id: Ia3952d015ad6091ad5a841f555acda78c9390e84
diff --git a/ui/build/soong.go b/ui/build/soong.go
index cbb75c7..a73082a 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -71,21 +71,31 @@
 		}
 	}()
 
+	var cfg microfactory.Config
+	cfg.Map("github.com/google/blueprint", "build/blueprint")
+
+	cfg.TrimPath = absPath(ctx, ".")
+
 	func() {
 		ctx.BeginTrace("minibp")
 		defer ctx.EndTrace()
 
-		var cfg microfactory.Config
-		cfg.Map("github.com/google/blueprint", "build/blueprint")
-
-		cfg.TrimPath = absPath(ctx, ".")
-
 		minibp := filepath.Join(config.SoongOutDir(), ".minibootstrap/minibp")
 		if _, err := microfactory.Build(&cfg, minibp, "github.com/google/blueprint/bootstrap/minibp"); err != nil {
 			ctx.Fatalln("Failed to build minibp:", err)
 		}
 	}()
 
+	func() {
+		ctx.BeginTrace("bpglob")
+		defer ctx.EndTrace()
+
+		bpglob := filepath.Join(config.SoongOutDir(), ".minibootstrap/bpglob")
+		if _, err := microfactory.Build(&cfg, bpglob, "github.com/google/blueprint/bootstrap/bpglob"); err != nil {
+			ctx.Fatalln("Failed to build bpglob:", err)
+		}
+	}()
+
 	ninja := func(name, file string) {
 		ctx.BeginTrace(name)
 		defer ctx.EndTrace()