Merge "Fix propagating EMPTY_NINJA_FILE from multiproduct_kati to minibp"

This commit is contained in:
Colin Cross
2021-06-01 21:55:25 +00:00
committed by Gerrit Code Review
4 changed files with 14 additions and 5 deletions

View File

@@ -433,7 +433,7 @@ func buildProduct(mpctx *mpContext, product string) {
config := build.NewConfig(ctx, args...)
config.Environment().Set("OUT_DIR", outDir)
if !*keepArtifacts {
config.Environment().Set("EMPTY_NINJA_FILE", "true")
config.SetEmptyNinjaFile(true)
}
build.FindSources(ctx, config, mpctx.Finder)
config.Lunch(ctx, product, *buildVariant)

View File

@@ -72,6 +72,9 @@ type configImpl struct {
// During Bazel execution, Bazel cannot write outside OUT_DIR.
// So if DIST_DIR is set to an external dir (outside of OUT_DIR), we need to rig it temporarily and then migrate files at the end of the build.
riggedDistDirForBazel string
// Set by multiproduct_kati
emptyNinjaFile bool
}
const srcDirFileCheck = "build/soong/root.bp"
@@ -203,9 +206,6 @@ func NewConfig(ctx Context, args ...string) Config {
"ANDROID_DEV_SCRIPTS",
"ANDROID_EMULATOR_PREBUILTS",
"ANDROID_PRE_BUILD_PATHS",
// Only set in multiproduct_kati after config generation
"EMPTY_NINJA_FILE",
)
if ret.UseGoma() || ret.ForceUseGoma() {
@@ -1189,3 +1189,11 @@ func (c *configImpl) LogsDir() string {
func (c *configImpl) BazelMetricsDir() string {
return filepath.Join(c.LogsDir(), "bazel_metrics")
}
func (c *configImpl) SetEmptyNinjaFile(v bool) {
c.emptyNinjaFile = v
}
func (c *configImpl) EmptyNinjaFile() bool {
return c.emptyNinjaFile
}

View File

@@ -136,7 +136,7 @@ func runKati(ctx Context, config Config, extraSuffix string, args []string, envF
// information out with --empty_ninja_file.
//
// From https://github.com/google/kati/commit/87b8da7af2c8bea28b1d8ab17679453d859f96e5
if config.Environment().IsEnvTrue("EMPTY_NINJA_FILE") {
if config.EmptyNinjaFile() {
args = append(args, "--empty_ninja_file")
}

View File

@@ -119,6 +119,7 @@ func bootstrapBlueprint(ctx Context, config Config, integratedBp2Build bool) {
args.OutFile = shared.JoinPath(config.SoongOutDir(), ".bootstrap/build.ninja")
args.GlobFile = globFile
args.GeneratingPrimaryBuilder = true
args.EmptyNinjaFile = config.EmptyNinjaFile()
args.DelveListen = os.Getenv("SOONG_DELVE")
if args.DelveListen != "" {