Make running soong_build in alternate modes nicer.
This includes the JSON graph generator and bp2build. Before: GENERATE_BAZEL_FILES=1 m nothing GENERATE_JSON_MODULE_GRAPH=1 m nothing Now: m json-module-graph m bp2build They can now also be combined with other targets or each other. The longer-term goal is to run "m queryview" and "m soong_docs" using the same infrastructure. There are two alternate approaches: 1. Call soong_build from within the main Ninja invocation. This requires two sequential soong_build invocations and is thus slower. 2. Do everything requested in the same soong_build invocation. This would be faster, but one AFAIU can't tell Ninja that multiple possible actions can build the same output so that doesn't work. (1) is somewhat more desirable because soong_docs seems to be built from build/make/core/main.mk ; I assume that that can be worked around although I haven't checked where the output of "m soong_docs" goes. Test: Presubmits. Change-Id: If5ba36490d9f3f60733e6d6be9286eb2b67c3ff5
This commit is contained in:
@@ -248,6 +248,16 @@ func Build(ctx Context, config Config) {
|
||||
what = what &^ RunNinja
|
||||
}
|
||||
|
||||
if !config.SoongBuildInvocationNeeded() {
|
||||
// This means that the output of soong_build is not needed and thus it would
|
||||
// run unnecessarily. In addition, if this code wasn't there invocations
|
||||
// with only special-cased target names like "m bp2build" would result in
|
||||
// passing Ninja the empty target list and it would then build the default
|
||||
// targets which is not what the user asked for.
|
||||
what = what &^ RunNinja
|
||||
what = what &^ RunKati
|
||||
}
|
||||
|
||||
if config.StartGoma() {
|
||||
startGoma(ctx, config)
|
||||
}
|
||||
@@ -278,16 +288,6 @@ func Build(ctx Context, config Config) {
|
||||
|
||||
if what&RunSoong != 0 {
|
||||
runSoong(ctx, config)
|
||||
|
||||
if config.bazelBuildMode() == generateBuildFiles {
|
||||
// Return early, if we're using Soong as solely the generator of BUILD files.
|
||||
return
|
||||
}
|
||||
|
||||
if config.bazelBuildMode() == generateJsonModuleGraph {
|
||||
// Return early, if we're using Soong as solely the generator of the JSON module graph
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if what&RunKati != 0 {
|
||||
|
Reference in New Issue
Block a user