Remove some unused args from Blueprint.
These are: TopFile and GeneratingPrimaryBuilder.
Also re-shuffle the list of flags to make a bit more sense and finish
the rename of BuildDir and NinjaBuildDir to SoongOutDir and OutDir,
respectively.
Test: Presubmits.
Change-Id: I103ff5f09f1c0d16f695a7da5dea13b55028e33e
diff --git a/android/config.go b/android/config.go
index b69963f..d3db68f 100644
--- a/android/config.go
+++ b/android/config.go
@@ -66,7 +66,7 @@
*config
}
-// BuildDir returns the build output directory for the configuration.
+// SoongOutDir returns the build output directory for the configuration.
func (c Config) SoongOutDir() string {
return c.soongOutDir
}
diff --git a/android/paths.go b/android/paths.go
index a733558..763cd7c 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -1150,7 +1150,7 @@
type OutputPath struct {
basePath
- // The soong build directory, i.e. Config.BuildDir()
+ // The soong build directory, i.e. Config.SoongOutDir()
soongOutDir string
fullPath string
@@ -1544,7 +1544,7 @@
type InstallPath struct {
basePath
- // The soong build directory, i.e. Config.BuildDir()
+ // The soong build directory, i.e. Config.SoongOutDir()
soongOutDir string
// partitionDir is the part of the InstallPath that is automatically determined according to the context.
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index beda184..16a4e1a 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -58,30 +58,32 @@
flag.StringVar(&outDir, "out", "", "Soong output directory (usually $TOP/out/soong)")
flag.StringVar(&availableEnvFile, "available_env", "", "File containing available environment variables")
flag.StringVar(&usedEnvFile, "used_env", "", "File containing used environment variables")
+ flag.StringVar(&globFile, "globFile", "build-globs.ninja", "the Ninja file of globs to output")
+ flag.StringVar(&globListDir, "globListDir", "", "the directory containing the glob list files")
+ flag.StringVar(&cmdlineArgs.SoongOutDir, "b", ".", "the build output directory")
+ flag.StringVar(&cmdlineArgs.OutDir, "n", "", "the ninja builddir directory")
+ flag.StringVar(&cmdlineArgs.ModuleListFile, "l", "", "file that lists filepaths to parse")
// Debug flags
flag.StringVar(&delveListen, "delve_listen", "", "Delve port to listen on for debugging")
flag.StringVar(&delvePath, "delve_path", "", "Path to Delve. Only used if --delve_listen is set")
+ flag.StringVar(&cmdlineArgs.Cpuprofile, "cpuprofile", "", "write cpu profile to file")
+ flag.StringVar(&cmdlineArgs.TraceFile, "trace", "", "write trace to file")
+ flag.StringVar(&cmdlineArgs.Memprofile, "memprofile", "", "write memory profile to file")
+ flag.BoolVar(&cmdlineArgs.NoGC, "nogc", false, "turn off GC for debugging")
// Flags representing various modes soong_build can run in
flag.StringVar(&moduleGraphFile, "module_graph_file", "", "JSON module graph file to output")
flag.StringVar(&docFile, "soong_docs", "", "build documentation file to output")
flag.StringVar(&bazelQueryViewDir, "bazel_queryview_dir", "", "path to the bazel queryview directory relative to --top")
flag.StringVar(&bp2buildMarker, "bp2build_marker", "", "If set, run bp2build, touch the specified marker file then exit")
-
flag.StringVar(&cmdlineArgs.OutFile, "o", "build.ninja", "the Ninja file to output")
- flag.StringVar(&globFile, "globFile", "build-globs.ninja", "the Ninja file of globs to output")
- flag.StringVar(&globListDir, "globListDir", "", "the directory containing the glob list files")
- flag.StringVar(&cmdlineArgs.BuildDir, "b", ".", "the build output directory")
- flag.StringVar(&cmdlineArgs.NinjaBuildDir, "n", "", "the ninja builddir directory")
- flag.StringVar(&cmdlineArgs.Cpuprofile, "cpuprofile", "", "write cpu profile to file")
- flag.StringVar(&cmdlineArgs.TraceFile, "trace", "", "write trace to file")
- flag.StringVar(&cmdlineArgs.Memprofile, "memprofile", "", "write memory profile to file")
- flag.BoolVar(&cmdlineArgs.NoGC, "nogc", false, "turn off GC for debugging")
+ flag.BoolVar(&cmdlineArgs.EmptyNinjaFile, "empty-ninja-file", false, "write out a 0-byte ninja file")
+
+ // Flags that probably shouldn't be flags of soong_build but we haven't found
+ // the time to remove them yet
flag.BoolVar(&cmdlineArgs.RunGoTests, "t", false, "build and run go tests during bootstrap")
flag.BoolVar(&cmdlineArgs.UseValidations, "use-validations", false, "use validations to depend on go tests")
- flag.StringVar(&cmdlineArgs.ModuleListFile, "l", "", "file that lists filepaths to parse")
- flag.BoolVar(&cmdlineArgs.EmptyNinjaFile, "empty-ninja-file", false, "write out a 0-byte ninja file")
}
func newNameResolver(config android.Config) *android.NameResolver {
@@ -503,8 +505,8 @@
"bazel-" + filepath.Base(topDir),
}
- if cmdlineArgs.NinjaBuildDir[0] != '/' {
- excludes = append(excludes, cmdlineArgs.NinjaBuildDir)
+ if cmdlineArgs.OutDir[0] != '/' {
+ excludes = append(excludes, cmdlineArgs.OutDir)
}
existingBazelRelatedFiles, err := getExistingBazelRelatedFiles(topDir)
diff --git a/ui/build/soong.go b/ui/build/soong.go
index 058f819..726b541 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -128,16 +128,14 @@
args.RunGoTests = !config.skipSoongTests
args.UseValidations = true // Use validations to depend on tests
- args.BuildDir = config.SoongOutDir()
- args.NinjaBuildDir = config.OutDir()
- args.TopFile = "Android.bp"
+ args.SoongOutDir = config.SoongOutDir()
+ args.OutDir = config.OutDir()
args.ModuleListFile = filepath.Join(config.FileListDir(), "Android.bp.list")
args.OutFile = shared.JoinPath(config.SoongOutDir(), ".bootstrap/build.ninja")
// The primary builder (aka soong_build) will use bootstrapGlobFile as the globFile to generate build.ninja(.d)
// Building soong_build does not require a glob file
// Using "" instead of "<soong_build_glob>.ninja" will ensure that an unused glob file is not written to out/soong/.bootstrap during StagePrimary
args.Subninjas = []string{bootstrapGlobFile, bp2buildGlobFile}
- args.GeneratingPrimaryBuilder = true
args.EmptyNinjaFile = config.EmptyNinjaFile()
args.DelveListen = os.Getenv("SOONG_DELVE")
@@ -213,6 +211,7 @@
debugCompilation: os.Getenv("SOONG_DELVE") != "",
}
+ args.EmptyNinjaFile = false
bootstrapDeps := bootstrap.RunBlueprint(args, blueprintCtx, blueprintConfig)
err := deptools.WriteDepFile(bootstrapDepFile, args.OutFile, bootstrapDeps)
if err != nil {