Add new file name to output inputs/outputs of actions of modules into a new file when m json-module-graph is executed.

And also delete the logic in droidstubs to output JSONDataActions.

Test: local.

Change-Id: Ib5d6f1f69c16c41f128e481131775c7699f96464
This commit is contained in:
kgui
2022-01-25 13:50:25 +08:00
parent c7afdefa26
commit 67007248a5
5 changed files with 17 additions and 46 deletions

View File

@@ -48,6 +48,7 @@ var (
delvePath string
moduleGraphFile string
moduleActionsFile string
docFile string
bazelQueryViewDir string
bp2buildMarker string
@@ -76,6 +77,7 @@ func init() {
// Flags representing various modes soong_build can run in
flag.StringVar(&moduleGraphFile, "module_graph_file", "", "JSON module graph file to output")
flag.StringVar(&moduleActionsFile, "module_actions_file", "", "JSON file to output inputs/outputs of actions of modules")
flag.StringVar(&docFile, "soong_docs", "", "build documentation file to output")
flag.StringVar(&bazelQueryViewDir, "bazel_queryview_dir", "", "path to the bazel queryview directory relative to --top")
flag.StringVar(&bp2buildMarker, "bp2build_marker", "", "If set, run bp2build, touch the specified marker file then exit")
@@ -176,15 +178,17 @@ func writeMetrics(configuration android.Config) {
}
}
func writeJsonModuleGraph(ctx *android.Context, path string) {
f, err := os.Create(shared.JoinPath(topDir, path))
if err != nil {
fmt.Fprintf(os.Stderr, "%s", err)
func writeJsonModuleGraphAndActions(ctx *android.Context, graphPath string, actionsPath string) {
graphFile, graphErr := os.Create(shared.JoinPath(topDir, graphPath))
actionsFile, actionsErr := os.Create(shared.JoinPath(topDir, actionsPath))
if graphErr != nil || actionsErr != nil {
fmt.Fprintf(os.Stderr, "Graph err: %s, actions err: %s", graphErr, actionsErr)
os.Exit(1)
}
defer f.Close()
ctx.Context.PrintJSONGraph(f)
defer graphFile.Close()
defer actionsFile.Close()
ctx.Context.PrintJSONGraphAndActions(graphFile, actionsFile)
}
func writeBuildGlobsNinjaFile(srcDir, buildDir string, globs func() pathtools.MultipleGlobResults, config interface{}) []string {
@@ -254,7 +258,7 @@ func doChosenActivity(configuration android.Config, extraNinjaDeps []string) str
writeDepFile(queryviewMarkerFile, ninjaDeps)
return queryviewMarkerFile
} else if generateModuleGraphFile {
writeJsonModuleGraph(ctx, moduleGraphFile)
writeJsonModuleGraphAndActions(ctx, moduleGraphFile, moduleActionsFile)
writeDepFile(moduleGraphFile, ninjaDeps)
return moduleGraphFile
} else if generateDocFile {