Generate actions when building the module graph.

This is necessary because GenerateAndroidBuildActions() is effectively a
mutator and therefore can change the data stored in each module.
Sometimes one wants to dump that data in the JSON module graph, and in
order to do so, actions need to be generated.

I briefly entertained removing StopBeforePrepareBuildActions(), but it
incurs a 10-second penalty on "m soong_docs" and "m bp2build" so I
decided to keep it.

Test: Presubmits.
Change-Id: I438aaf981e989dc39a09e8a2ba73f7a08ee55386
This commit is contained in:
Lukacs T. Berki 2021-10-26 13:32:59 +02:00
parent cbab07b45f
commit eb0454b2a4

View file

@ -217,15 +217,6 @@ func doChosenActivity(configuration android.Config, extraNinjaDeps []string) str
generateModuleGraphFile := moduleGraphFile != "" generateModuleGraphFile := moduleGraphFile != ""
generateDocFile := docFile != "" generateDocFile := docFile != ""
blueprintArgs := cmdlineArgs
var stopBefore bootstrap.StopBefore
if !generateModuleGraphFile && !generateQueryView && !generateDocFile {
stopBefore = bootstrap.DoEverything
} else {
stopBefore = bootstrap.StopBeforePrepareBuildActions
}
if generateBazelWorkspace { if generateBazelWorkspace {
// Run the alternate pipeline of bp2build mutators and singleton to convert // Run the alternate pipeline of bp2build mutators and singleton to convert
// Blueprint to BUILD files before everything else. // Blueprint to BUILD files before everything else.
@ -233,6 +224,19 @@ func doChosenActivity(configuration android.Config, extraNinjaDeps []string) str
return bp2buildMarker return bp2buildMarker
} }
blueprintArgs := cmdlineArgs
var stopBefore bootstrap.StopBefore
if generateModuleGraphFile {
stopBefore = bootstrap.StopBeforeWriteNinja
} else if generateQueryView {
stopBefore = bootstrap.StopBeforePrepareBuildActions
} else if generateDocFile {
stopBefore = bootstrap.StopBeforePrepareBuildActions
} else {
stopBefore = bootstrap.DoEverything
}
ctx := newContext(configuration) ctx := newContext(configuration)
if mixedModeBuild { if mixedModeBuild {
runMixedModeBuild(configuration, ctx, extraNinjaDeps) runMixedModeBuild(configuration, ctx, extraNinjaDeps)