Merge "Compile soong_build for debugging if needed."

This commit is contained in:
Lukács T. Berki
2021-03-18 08:58:16 +00:00
committed by Gerrit Code Review
2 changed files with 16 additions and 6 deletions

View File

@@ -73,6 +73,10 @@ func (c Config) NinjaBuildDir() string {
return c.buildDir return c.buildDir
} }
func (c Config) DebugCompilation() bool {
return false // Never compile Go code in the main build for debugging
}
func (c Config) SrcDir() string { func (c Config) SrcDir() string {
return c.srcDir return c.srcDir
} }

View File

@@ -65,9 +65,10 @@ func writeEnvironmentFile(ctx Context, envFile string, envDeps map[string]string
// A tiny struct used to tell Blueprint that it's in bootstrap mode. It would // A tiny struct used to tell Blueprint that it's in bootstrap mode. It would
// probably be nicer to use a flag in bootstrap.Args instead. // probably be nicer to use a flag in bootstrap.Args instead.
type BlueprintConfig struct { type BlueprintConfig struct {
srcDir string srcDir string
buildDir string buildDir string
ninjaBuildDir string ninjaBuildDir string
debugCompilation bool
} }
func (c BlueprintConfig) SrcDir() string { func (c BlueprintConfig) SrcDir() string {
@@ -82,6 +83,10 @@ func (c BlueprintConfig) NinjaBuildDir() string {
return c.ninjaBuildDir return c.ninjaBuildDir
} }
func (c BlueprintConfig) DebugCompilation() bool {
return c.debugCompilation
}
func bootstrapBlueprint(ctx Context, config Config) { func bootstrapBlueprint(ctx Context, config Config) {
ctx.BeginTrace(metrics.RunSoong, "blueprint bootstrap") ctx.BeginTrace(metrics.RunSoong, "blueprint bootstrap")
defer ctx.EndTrace() defer ctx.EndTrace()
@@ -102,9 +107,10 @@ func bootstrapBlueprint(ctx Context, config Config) {
blueprintCtx := blueprint.NewContext() blueprintCtx := blueprint.NewContext()
blueprintCtx.SetIgnoreUnknownModuleTypes(true) blueprintCtx.SetIgnoreUnknownModuleTypes(true)
blueprintConfig := BlueprintConfig{ blueprintConfig := BlueprintConfig{
srcDir: os.Getenv("TOP"), srcDir: os.Getenv("TOP"),
buildDir: config.SoongOutDir(), buildDir: config.SoongOutDir(),
ninjaBuildDir: config.OutDir(), ninjaBuildDir: config.OutDir(),
debugCompilation: os.Getenv("SOONG_DELVE") != "",
} }
bootstrap.RunBlueprint(args, blueprintCtx, blueprintConfig) bootstrap.RunBlueprint(args, blueprintCtx, blueprintConfig)