aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/command.go
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2015-06-24 19:21:21 -0700
committerDan Willemsen <dwillemsen@google.com>2015-06-24 22:44:37 -0700
commit30a80c3e5fd67a394094efd93ec878a260f508f1 (patch)
tree734fdd930ea4a842ae1a7becb2574bdaf0412053 /bootstrap/command.go
parent2a874e45a916aab752634b7b2bb0892d4e46bef8 (diff)
downloadandroid_build_blueprint-30a80c3e5fd67a394094efd93ec878a260f508f1.tar.gz
android_build_blueprint-30a80c3e5fd67a394094efd93ec878a260f508f1.tar.bz2
android_build_blueprint-30a80c3e5fd67a394094efd93ec878a260f508f1.zip
Create internal bootstrap Config struct
Change-Id: If5c5ce3d5c46196cf9b77ff9f5c68b8849474823
Diffstat (limited to 'bootstrap/command.go')
-rw-r--r--bootstrap/command.go30
1 files changed, 16 insertions, 14 deletions
diff --git a/bootstrap/command.go b/bootstrap/command.go
index 05a3e9d..354a692 100644
--- a/bootstrap/command.go
+++ b/bootstrap/command.go
@@ -36,12 +36,6 @@ var (
cpuprofile string
)
-// topLevelBlueprintsFile is set by Main as a way to pass this information on to
-// the bootstrap build manifest generators. This information was not passed via
-// the config object so as to allow the caller of Main to use whatever Config
-// object it wants.
-var topLevelBlueprintsFile string
-
func init() {
flag.StringVar(&outFile, "o", "build.ninja.in", "the Ninja file to output")
flag.StringVar(&depFile, "d", "", "the dependency file to output")
@@ -67,17 +61,25 @@ func Main(ctx *blueprint.Context, config interface{}, extraNinjaFileDeps ...stri
defer pprof.StopCPUProfile()
}
- ctx.RegisterModuleType("bootstrap_go_package", newGoPackageModule)
- ctx.RegisterModuleType("bootstrap_go_binary", newGoBinaryModule)
- ctx.RegisterSingletonType("bootstrap", newSingleton)
-
if flag.NArg() != 1 {
fatalf("no Blueprints file specified")
}
- topLevelBlueprintsFile = flag.Arg(0)
+ generatingBootstrapper := false
+ if c, ok := config.(ConfigInterface); ok {
+ generatingBootstrapper = c.GeneratingBootstrapper()
+ }
+
+ bootstrapConfig := &Config{
+ generatingBootstrapper: generatingBootstrapper,
+ topLevelBlueprintsFile: flag.Arg(0),
+ }
+
+ ctx.RegisterModuleType("bootstrap_go_package", newGoPackageModuleFactory(bootstrapConfig))
+ ctx.RegisterModuleType("bootstrap_go_binary", newGoBinaryModuleFactory(bootstrapConfig))
+ ctx.RegisterSingletonType("bootstrap", newSingletonFactory(bootstrapConfig))
- deps, errs := ctx.ParseBlueprintsFiles(topLevelBlueprintsFile)
+ deps, errs := ctx.ParseBlueprintsFiles(bootstrapConfig.topLevelBlueprintsFile)
if len(errs) > 0 {
fatalErrors(errs)
}
@@ -142,8 +144,8 @@ func Main(ctx *blueprint.Context, config interface{}, extraNinjaFileDeps ...stri
}
}
- srcDir := filepath.Dir(topLevelBlueprintsFile)
- err = removeAbandonedFiles(ctx, config, srcDir, manifestFile)
+ srcDir := filepath.Dir(bootstrapConfig.topLevelBlueprintsFile)
+ err = removeAbandonedFiles(ctx, bootstrapConfig, srcDir, manifestFile)
if err != nil {
fatalf("error removing abandoned files: %s", err)
}