Merge "Bootstrap empty glob file" am: 7e81e1efbc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1735978 Change-Id: I551d19fb1e5cfaf3973e354e86691e7728abf07e
This commit is contained in:
@@ -99,6 +99,21 @@ func environmentArgs(config Config, suffix string) []string {
|
||||
"--used_env", shared.JoinPath(config.SoongOutDir(), usedEnvFile+suffix),
|
||||
}
|
||||
}
|
||||
|
||||
func writeEmptyGlobFile(ctx Context, path string) {
|
||||
err := os.MkdirAll(filepath.Dir(path), 0777)
|
||||
if err != nil {
|
||||
ctx.Fatalf("Failed to create parent directories of empty ninja glob file '%s': %s", path, err)
|
||||
}
|
||||
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
err = ioutil.WriteFile(path, nil, 0666)
|
||||
if err != nil {
|
||||
ctx.Fatalf("Failed to create empty ninja glob file '%s': %s", path, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func bootstrapBlueprint(ctx Context, config Config, integratedBp2Build bool) {
|
||||
ctx.BeginTrace(metrics.RunSoong, "blueprint bootstrap")
|
||||
defer ctx.EndTrace()
|
||||
@@ -106,8 +121,10 @@ func bootstrapBlueprint(ctx Context, config Config, integratedBp2Build bool) {
|
||||
var args bootstrap.Args
|
||||
|
||||
mainNinjaFile := shared.JoinPath(config.SoongOutDir(), "build.ninja")
|
||||
globFile := shared.JoinPath(config.SoongOutDir(), ".bootstrap/soong-build-globs.ninja")
|
||||
bootstrapGlobFile := shared.JoinPath(config.SoongOutDir(), ".bootstrap/build-globs.ninja")
|
||||
// .bootstrap/build.ninja "includes" .bootstrap/build-globs.ninja for incremental builds
|
||||
// generate an empty glob before running any rule in .bootstrap/build.ninja
|
||||
writeEmptyGlobFile(ctx, bootstrapGlobFile)
|
||||
bootstrapDepFile := shared.JoinPath(config.SoongOutDir(), ".bootstrap/build.ninja.d")
|
||||
|
||||
args.RunGoTests = !config.skipSoongTests
|
||||
@@ -117,7 +134,10 @@ func bootstrapBlueprint(ctx Context, config Config, integratedBp2Build bool) {
|
||||
args.TopFile = "Android.bp"
|
||||
args.ModuleListFile = filepath.Join(config.FileListDir(), "Android.bp.list")
|
||||
args.OutFile = shared.JoinPath(config.SoongOutDir(), ".bootstrap/build.ninja")
|
||||
args.GlobFile = globFile
|
||||
// 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.GlobFile = ""
|
||||
args.GeneratingPrimaryBuilder = true
|
||||
args.EmptyNinjaFile = config.EmptyNinjaFile()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user