Remove global variables from Blueprint.

The end goal of this exercise is to remove all mutable global state so
that multiple Blueprint instances can be run in the same process.

Test: Presubmit.
Change-Id: Idb34b0920f2c7d92efb9328ce8a78b7306f89571
diff --git a/android/config.go b/android/config.go
index bc1aa3a..3869a76 100644
--- a/android/config.go
+++ b/android/config.go
@@ -68,6 +68,14 @@
 	return c.buildDir
 }
 
+func (c Config) NinjaBuildDir() string {
+	return c.buildDir
+}
+
+func (c Config) SrcDir() string {
+	return c.srcDir
+}
+
 // A DeviceConfig object represents the configuration for a particular device
 // being built. For now there will only be one of these, but in the future there
 // may be multiple devices being built.
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index 4586f44..0c80605 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -158,7 +158,7 @@
 	}
 
 	if docFile != "" {
-		if err := writeDocs(ctx, docFile); err != nil {
+		if err := writeDocs(ctx, configuration, docFile); err != nil {
 			fmt.Fprintf(os.Stderr, "%s", err)
 			os.Exit(1)
 		}
diff --git a/cmd/soong_build/writedocs.go b/cmd/soong_build/writedocs.go
index f2c2c9b..a69de6a 100644
--- a/cmd/soong_build/writedocs.go
+++ b/cmd/soong_build/writedocs.go
@@ -95,13 +95,13 @@
 	return result
 }
 
-func getPackages(ctx *android.Context) ([]*bpdoc.Package, error) {
+func getPackages(ctx *android.Context, config interface{}) ([]*bpdoc.Package, error) {
 	moduleTypeFactories := android.ModuleTypeFactoriesForDocs()
-	return bootstrap.ModuleTypeDocs(ctx.Context, moduleTypeFactories)
+	return bootstrap.ModuleTypeDocs(ctx.Context, config, moduleTypeFactories)
 }
 
-func writeDocs(ctx *android.Context, filename string) error {
-	packages, err := getPackages(ctx)
+func writeDocs(ctx *android.Context, config interface{}, filename string) error {
+	packages, err := getPackages(ctx, config)
 	if err != nil {
 		return err
 	}