Allow Soong to generate its own build documentation

Add a rule in soong that re-executes soong_build in order to
generate build documentation.  This allows Soong to customize
the documentation.

Bug: 70516282
Test: m soong_docs
Change-Id: If143cfacd6ac20274cd7bb8d8fab0c07025a5553
This commit is contained in:
Colin Cross
2017-12-11 15:52:26 -08:00
parent 59014396ba
commit e87040b2eb
6 changed files with 234 additions and 2 deletions

View File

@@ -25,6 +25,14 @@ import (
"android/soong/android"
)
var (
docFile string
)
func init() {
flag.StringVar(&docFile, "soong_docs", "", "build documentation file to output")
}
func newNameResolver(config android.Config) *android.NameResolver {
namespacePathsToExport := make(map[string]bool)
@@ -56,9 +64,17 @@ func main() {
os.Exit(1)
}
if docFile != "" {
configuration.SetStopBefore(bootstrap.StopBeforePrepareBuildActions)
}
ctx.SetNameInterface(newNameResolver(configuration))
ctx.SetAllowMissingDependencies(configuration.AllowMissingDependencies())
bootstrap.Main(ctx.Context, configuration, configuration.ConfigFileName, configuration.ProductVariablesFileName)
if docFile != "" {
writeDocs(ctx, docFile)
}
}