Handle errors from RunBlueprint().
Bug: 244730498
Test: Presubmits.
Change-Id: I264f1e4bd989b1c219800eec3be007c3f114c6d1
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index 989dd7f..10a5762 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -124,7 +124,8 @@
return ctx.Config().BazelContext.InvokeBazel(ctx.Config(), ctx)
}
ctx.SetBeforePrepareBuildActionsHook(bazelHook)
- ninjaDeps := bootstrap.RunBlueprint(cmdlineArgs.Args, bootstrap.DoEverything, ctx.Context, ctx.Config())
+ ninjaDeps, err := bootstrap.RunBlueprint(cmdlineArgs.Args, bootstrap.DoEverything, ctx.Context, ctx.Config())
+ maybeQuit(err, "")
ninjaDeps = append(ninjaDeps, extraNinjaDeps...)
bazelPaths, err := readFileLines(ctx.Config().Getenv("BAZEL_DEPS_FILE"))
@@ -185,10 +186,11 @@
}
// Run the loading and analysis phase
- ninjaDeps := bootstrap.RunBlueprint(cmdlineArgs.Args,
+ ninjaDeps, err := bootstrap.RunBlueprint(cmdlineArgs.Args,
bootstrap.StopBeforePrepareBuildActions,
ctx.Context,
ctx.Config())
+ maybeQuit(err, "")
ninjaDeps = append(ninjaDeps, extraNinjaDeps...)
// Add the globbed dependencies
@@ -218,7 +220,7 @@
// }
//
// If we don't generate f/b/api/BUILD, foo.contribution will be unbuildable.
- err := createBazelWorkspace(codegenContext, absoluteApiBp2buildDir, true)
+ err = createBazelWorkspace(codegenContext, absoluteApiBp2buildDir, true)
maybeQuit(err, "")
ninjaDeps = append(ninjaDeps, codegenContext.AdditionalNinjaDeps()...)
@@ -412,12 +414,13 @@
defer ctx.EventHandler.End("globs_ninja_file")
globDir := bootstrap.GlobDirectory(ctx.Config().SoongOutDir(), globListDir)
- bootstrap.WriteBuildGlobsNinjaFile(&bootstrap.GlobSingleton{
+ err := bootstrap.WriteBuildGlobsNinjaFile(&bootstrap.GlobSingleton{
GlobLister: ctx.Globs,
GlobFile: globFile,
GlobDir: globDir,
SrcDir: ctx.SrcDir(),
}, ctx.Config())
+ maybeQuit(err, "")
return bootstrap.GlobFileListFiles(globDir)
}
@@ -444,7 +447,8 @@
stopBefore = bootstrap.DoEverything
}
- ninjaDeps := bootstrap.RunBlueprint(cmdlineArgs.Args, stopBefore, ctx.Context, ctx.Config())
+ ninjaDeps, err := bootstrap.RunBlueprint(cmdlineArgs.Args, stopBefore, ctx.Context, ctx.Config())
+ maybeQuit(err, "")
ninjaDeps = append(ninjaDeps, extraNinjaDeps...)
globListFiles := writeBuildGlobsNinjaFile(ctx)
@@ -803,8 +807,9 @@
// from the regular Modules.
ctx.EventHandler.Do("bootstrap", func() {
blueprintArgs := cmdlineArgs
- bootstrapDeps := bootstrap.RunBlueprint(blueprintArgs.Args,
+ bootstrapDeps, err := bootstrap.RunBlueprint(blueprintArgs.Args,
bootstrap.StopBeforePrepareBuildActions, ctx.Context, ctx.Config())
+ maybeQuit(err, "")
ninjaDeps = append(ninjaDeps, bootstrapDeps...)
})