Use HINT_FROM_SOONG if ninja_log doesn't exist
In non-incremental build, there is no ninja_log. For this case, use HINT_FROM_SOONG as an alternative solution. Bug: 273947040 Test: 1.m after removing out/.ninja_log 2.check if non-incremental CI build uses HINT_FROM_SOOONG 3.check if incremental CI build uses NINJA_LOG 4.check if there is no regression in CUJ Change-Id: I00cd216df096cb2288eeab233729acefb0d1b73c
This commit is contained in:
committed by
Martin Stjernholm
parent
672c1467d5
commit
a87506f5e8
@@ -16,6 +16,7 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
@@ -135,12 +136,24 @@ func runMixedModeBuild(ctx *android.Context, extraNinjaDeps []string) string {
|
||||
|
||||
writeDepFile(cmdlineArgs.OutFile, ctx.EventHandler, ninjaDeps)
|
||||
|
||||
if ctx.Config().IsEnvTrue("SOONG_GENERATES_NINJA_HINT") {
|
||||
if needToWriteNinjaHint(ctx) {
|
||||
writeNinjaHint(ctx)
|
||||
}
|
||||
return cmdlineArgs.OutFile
|
||||
}
|
||||
|
||||
func needToWriteNinjaHint(ctx *android.Context) bool {
|
||||
switch ctx.Config().GetenvWithDefault("SOONG_GENERATES_NINJA_HINT", "") {
|
||||
case "always":
|
||||
return true
|
||||
case "depend":
|
||||
if _, err := os.Stat(filepath.Join(ctx.Config().OutDir(), ".ninja_log")); errors.Is(err, os.ErrNotExist) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Run the code-generation phase to convert BazelTargetModules to BUILD files.
|
||||
func runQueryView(queryviewDir, queryviewMarker string, ctx *android.Context) {
|
||||
ctx.EventHandler.Begin("queryview")
|
||||
@@ -460,7 +473,7 @@ func runSoongOnlyBuild(ctx *android.Context, extraNinjaDeps []string) string {
|
||||
// The actual output (build.ninja) was written in the RunBlueprint() call
|
||||
// above
|
||||
writeDepFile(cmdlineArgs.OutFile, ctx.EventHandler, ninjaDeps)
|
||||
if ctx.Config().IsEnvTrue("SOONG_GENERATES_NINJA_HINT") {
|
||||
if needToWriteNinjaHint(ctx) {
|
||||
writeNinjaHint(ctx)
|
||||
}
|
||||
return cmdlineArgs.OutFile
|
||||
|
Reference in New Issue
Block a user