Merge "Remove some unused args from Blueprint."

This commit is contained in:
Lukács T. Berki
2021-08-31 13:38:14 +00:00
committed by Gerrit Code Review
4 changed files with 21 additions and 20 deletions

View File

@@ -66,7 +66,7 @@ type Config struct {
*config *config
} }
// BuildDir returns the build output directory for the configuration. // SoongOutDir returns the build output directory for the configuration.
func (c Config) SoongOutDir() string { func (c Config) SoongOutDir() string {
return c.soongOutDir return c.soongOutDir
} }

View File

@@ -1150,7 +1150,7 @@ func (p SourcePath) OverlayPath(ctx ModuleMissingDepsPathContext, path Path) Opt
type OutputPath struct { type OutputPath struct {
basePath basePath
// The soong build directory, i.e. Config.BuildDir() // The soong build directory, i.e. Config.SoongOutDir()
soongOutDir string soongOutDir string
fullPath string fullPath string
@@ -1544,7 +1544,7 @@ func PathForModuleRes(ctx ModuleOutPathContext, pathComponents ...string) Module
type InstallPath struct { type InstallPath struct {
basePath basePath
// The soong build directory, i.e. Config.BuildDir() // The soong build directory, i.e. Config.SoongOutDir()
soongOutDir string soongOutDir string
// partitionDir is the part of the InstallPath that is automatically determined according to the context. // partitionDir is the part of the InstallPath that is automatically determined according to the context.

View File

@@ -58,30 +58,32 @@ func init() {
flag.StringVar(&outDir, "out", "", "Soong output directory (usually $TOP/out/soong)") flag.StringVar(&outDir, "out", "", "Soong output directory (usually $TOP/out/soong)")
flag.StringVar(&availableEnvFile, "available_env", "", "File containing available environment variables") flag.StringVar(&availableEnvFile, "available_env", "", "File containing available environment variables")
flag.StringVar(&usedEnvFile, "used_env", "", "File containing used 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 // Debug flags
flag.StringVar(&delveListen, "delve_listen", "", "Delve port to listen on for debugging") 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(&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 // Flags representing various modes soong_build can run in
flag.StringVar(&moduleGraphFile, "module_graph_file", "", "JSON module graph file to output") flag.StringVar(&moduleGraphFile, "module_graph_file", "", "JSON module graph file to output")
flag.StringVar(&docFile, "soong_docs", "", "build documentation 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(&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(&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(&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.BoolVar(&cmdlineArgs.EmptyNinjaFile, "empty-ninja-file", false, "write out a 0-byte ninja file")
flag.StringVar(&globListDir, "globListDir", "", "the directory containing the glob list files")
flag.StringVar(&cmdlineArgs.BuildDir, "b", ".", "the build output directory") // Flags that probably shouldn't be flags of soong_build but we haven't found
flag.StringVar(&cmdlineArgs.NinjaBuildDir, "n", "", "the ninja builddir directory") // the time to remove them yet
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.RunGoTests, "t", false, "build and run go tests during bootstrap") 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.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 { func newNameResolver(config android.Config) *android.NameResolver {
@@ -503,8 +505,8 @@ func runBp2Build(configuration android.Config, extraNinjaDeps []string) {
"bazel-" + filepath.Base(topDir), "bazel-" + filepath.Base(topDir),
} }
if cmdlineArgs.NinjaBuildDir[0] != '/' { if cmdlineArgs.OutDir[0] != '/' {
excludes = append(excludes, cmdlineArgs.NinjaBuildDir) excludes = append(excludes, cmdlineArgs.OutDir)
} }
existingBazelRelatedFiles, err := getExistingBazelRelatedFiles(topDir) existingBazelRelatedFiles, err := getExistingBazelRelatedFiles(topDir)

View File

@@ -128,16 +128,14 @@ func bootstrapBlueprint(ctx Context, config Config) {
args.RunGoTests = !config.skipSoongTests args.RunGoTests = !config.skipSoongTests
args.UseValidations = true // Use validations to depend on tests args.UseValidations = true // Use validations to depend on tests
args.BuildDir = config.SoongOutDir() args.SoongOutDir = config.SoongOutDir()
args.NinjaBuildDir = config.OutDir() args.OutDir = config.OutDir()
args.TopFile = "Android.bp"
args.ModuleListFile = filepath.Join(config.FileListDir(), "Android.bp.list") args.ModuleListFile = filepath.Join(config.FileListDir(), "Android.bp.list")
args.OutFile = shared.JoinPath(config.SoongOutDir(), ".bootstrap/build.ninja") 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) // 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 // 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 // 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.Subninjas = []string{bootstrapGlobFile, bp2buildGlobFile}
args.GeneratingPrimaryBuilder = true
args.EmptyNinjaFile = config.EmptyNinjaFile() args.EmptyNinjaFile = config.EmptyNinjaFile()
args.DelveListen = os.Getenv("SOONG_DELVE") args.DelveListen = os.Getenv("SOONG_DELVE")
@@ -213,6 +211,7 @@ func bootstrapBlueprint(ctx Context, config Config) {
debugCompilation: os.Getenv("SOONG_DELVE") != "", debugCompilation: os.Getenv("SOONG_DELVE") != "",
} }
args.EmptyNinjaFile = false
bootstrapDeps := bootstrap.RunBlueprint(args, blueprintCtx, blueprintConfig) bootstrapDeps := bootstrap.RunBlueprint(args, blueprintCtx, blueprintConfig)
err := deptools.WriteDepFile(bootstrapDepFile, args.OutFile, bootstrapDeps) err := deptools.WriteDepFile(bootstrapDepFile, args.OutFile, bootstrapDeps)
if err != nil { if err != nil {