Bootstrap empty glob file
1. Initialize an empty glob file for .bootstrap/build.ninja. Initializing in soong_ui (and not soong_build) prevents inadvertently creating the file inside the source tree 2. Remove soong-build-globs.ninja, which is not used during the build Bug: 187194795 Test: Ran the following command locally for the target art-target-arm:git_master-art ``` . ./build/envsetup.sh && lunch armv8-eng && art/tools/buildbot-build.sh --target ``` Change-Id: Ibe6eeff65ea1ab25136642299e9878d0da1cac42
This commit is contained in:
@@ -99,6 +99,21 @@ func environmentArgs(config Config, suffix string) []string {
|
|||||||
"--used_env", shared.JoinPath(config.SoongOutDir(), usedEnvFile+suffix),
|
"--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) {
|
func bootstrapBlueprint(ctx Context, config Config, integratedBp2Build bool) {
|
||||||
ctx.BeginTrace(metrics.RunSoong, "blueprint bootstrap")
|
ctx.BeginTrace(metrics.RunSoong, "blueprint bootstrap")
|
||||||
defer ctx.EndTrace()
|
defer ctx.EndTrace()
|
||||||
@@ -106,8 +121,10 @@ func bootstrapBlueprint(ctx Context, config Config, integratedBp2Build bool) {
|
|||||||
var args bootstrap.Args
|
var args bootstrap.Args
|
||||||
|
|
||||||
mainNinjaFile := shared.JoinPath(config.SoongOutDir(), "build.ninja")
|
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")
|
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")
|
bootstrapDepFile := shared.JoinPath(config.SoongOutDir(), ".bootstrap/build.ninja.d")
|
||||||
|
|
||||||
args.RunGoTests = !config.skipSoongTests
|
args.RunGoTests = !config.skipSoongTests
|
||||||
@@ -117,7 +134,10 @@ func bootstrapBlueprint(ctx Context, config Config, integratedBp2Build bool) {
|
|||||||
args.TopFile = "Android.bp"
|
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")
|
||||||
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.GeneratingPrimaryBuilder = true
|
||||||
args.EmptyNinjaFile = config.EmptyNinjaFile()
|
args.EmptyNinjaFile = config.EmptyNinjaFile()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user