Merge "LOG_DIR changes should not trigger soong_build to re-run"
This commit is contained in:
@@ -166,8 +166,7 @@ func runQueryView(queryviewDir, queryviewMarker string, configuration android.Co
|
||||
touch(shared.JoinPath(topDir, queryviewMarker))
|
||||
}
|
||||
|
||||
func writeMetrics(configuration android.Config, eventHandler metrics.EventHandler) {
|
||||
metricsDir := configuration.Getenv("LOG_DIR")
|
||||
func writeMetrics(configuration android.Config, eventHandler metrics.EventHandler, metricsDir string) {
|
||||
if len(metricsDir) < 1 {
|
||||
fmt.Fprintf(os.Stderr, "\nMissing required env var for generating soong metrics: LOG_DIR\n")
|
||||
os.Exit(1)
|
||||
@@ -221,7 +220,7 @@ func writeDepFile(outputFile string, eventHandler metrics.EventHandler, ninjaDep
|
||||
// doChosenActivity runs Soong for a specific activity, like bp2build, queryview
|
||||
// or the actual Soong build for the build.ninja file. Returns the top level
|
||||
// output file of the specific activity.
|
||||
func doChosenActivity(configuration android.Config, extraNinjaDeps []string) string {
|
||||
func doChosenActivity(configuration android.Config, extraNinjaDeps []string, logDir string) string {
|
||||
mixedModeBuild := configuration.BazelContext.BazelEnabled()
|
||||
generateBazelWorkspace := bp2buildMarker != ""
|
||||
generateQueryView := bazelQueryViewDir != ""
|
||||
@@ -285,7 +284,7 @@ func doChosenActivity(configuration android.Config, extraNinjaDeps []string) str
|
||||
}
|
||||
}
|
||||
|
||||
writeMetrics(configuration, *ctx.EventHandler)
|
||||
writeMetrics(configuration, *ctx.EventHandler, logDir)
|
||||
return cmdlineArgs.OutFile
|
||||
}
|
||||
|
||||
@@ -341,7 +340,11 @@ func main() {
|
||||
extraNinjaDeps = append(extraNinjaDeps, filepath.Join(configuration.SoongOutDir(), "always_rerun_for_delve"))
|
||||
}
|
||||
|
||||
finalOutputFile := doChosenActivity(configuration, extraNinjaDeps)
|
||||
// Bypass configuration.Getenv, as LOG_DIR does not need to be dependency tracked. By definition, it will
|
||||
// change between every CI build, so tracking it would require re-running Soong for every build.
|
||||
logDir := availableEnv["LOG_DIR"]
|
||||
|
||||
finalOutputFile := doChosenActivity(configuration, extraNinjaDeps, logDir)
|
||||
|
||||
writeUsedEnvironmentFile(configuration, finalOutputFile)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user