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
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index f07eafa..b3a6ee0 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -48,6 +48,7 @@
delvePath string
moduleGraphFile string
+ moduleActionsFile string
docFile string
bazelQueryViewDir string
bp2buildMarker string
@@ -76,6 +77,7 @@
// 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 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 @@
writeDepFile(queryviewMarkerFile, ninjaDeps)
return queryviewMarkerFile
} else if generateModuleGraphFile {
- writeJsonModuleGraph(ctx, moduleGraphFile)
+ writeJsonModuleGraphAndActions(ctx, moduleGraphFile, moduleActionsFile)
writeDepFile(moduleGraphFile, ninjaDeps)
return moduleGraphFile
} else if generateDocFile {