Merge "Minor cleanup of soong.go."
This commit is contained in:
@@ -30,16 +30,33 @@ import (
|
|||||||
"android/soong/ui/status"
|
"android/soong/ui/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// This uses Android.bp files and various tools to generate <builddir>/build.ninja.
|
||||||
|
//
|
||||||
|
// However, the execution of <builddir>/build.ninja happens later in build/soong/ui/build/build.go#Build()
|
||||||
|
//
|
||||||
|
// We want to rely on as few prebuilts as possible, so there is some bootstrapping here.
|
||||||
|
//
|
||||||
|
// "Microfactory" is a tool for compiling Go code. We use it to build two other tools:
|
||||||
|
// - minibp, used to generate build.ninja files. This is really build/blueprint/bootstrap/command.go#Main()
|
||||||
|
// - bpglob, used during incremental builds to identify files in a glob that have changed
|
||||||
|
//
|
||||||
|
// In reality, several build.ninja files are generated and/or used during the bootstrapping and build process.
|
||||||
|
// See build/blueprint/bootstrap/doc.go for more information.
|
||||||
|
//
|
||||||
func runSoong(ctx Context, config Config) {
|
func runSoong(ctx Context, config Config) {
|
||||||
ctx.BeginTrace(metrics.RunSoong, "soong")
|
ctx.BeginTrace(metrics.RunSoong, "soong")
|
||||||
defer ctx.EndTrace()
|
defer ctx.EndTrace()
|
||||||
|
|
||||||
|
// Use an anonymous inline function for tracing purposes (this pattern is used several times below).
|
||||||
func() {
|
func() {
|
||||||
ctx.BeginTrace(metrics.RunSoong, "blueprint bootstrap")
|
ctx.BeginTrace(metrics.RunSoong, "blueprint bootstrap")
|
||||||
defer ctx.EndTrace()
|
defer ctx.EndTrace()
|
||||||
|
|
||||||
|
// Use validations to depend on tests.
|
||||||
args := []string{"-n"}
|
args := []string{"-n"}
|
||||||
|
|
||||||
if !config.skipSoongTests {
|
if !config.skipSoongTests {
|
||||||
|
// Run tests.
|
||||||
args = append(args, "-t")
|
args = append(args, "-t")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +162,10 @@ func runSoong(ctx Context, config Config) {
|
|||||||
cmd.RunAndStreamOrFatal()
|
cmd.RunAndStreamOrFatal()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This build generates .bootstrap/build.ninja, which is used in the next step.
|
||||||
ninja("minibootstrap", ".minibootstrap/build.ninja")
|
ninja("minibootstrap", ".minibootstrap/build.ninja")
|
||||||
|
|
||||||
|
// This build generates <builddir>/build.ninja, which is used later by build/soong/ui/build/build.go#Build().
|
||||||
ninja("bootstrap", ".bootstrap/build.ninja")
|
ninja("bootstrap", ".bootstrap/build.ninja")
|
||||||
|
|
||||||
soongBuildMetrics := loadSoongBuildMetrics(ctx, config)
|
soongBuildMetrics := loadSoongBuildMetrics(ctx, config)
|
||||||
|
Reference in New Issue
Block a user