Add dumping the module graph in JSON format.

Usage: SOONG_DUMP_MODULE_GRPH_JSON=<filename> m nothing

Test: The new test case in bootstrap_test.sh .
Change-Id: I69005a75d47dff915d27187645d0cd1cbb3467ef
diff --git a/bootstrap_test.sh b/bootstrap_test.sh
index 6c5338a..9d87697 100755
--- a/bootstrap_test.sh
+++ b/bootstrap_test.sh
@@ -402,6 +402,14 @@
   fi
 }
 
+function test_dump_json_module_graph() {
+  setup
+  SOONG_DUMP_JSON_MODULE_GRAPH="$MOCK_TOP/modules.json" run_soong
+  if [[ ! -r "$MOCK_TOP/modules.json" ]]; then
+    fail "JSON file was not created"
+  fi
+}
+
 test_bazel_smoke
 test_smoke
 test_null_build
@@ -413,3 +421,4 @@
 test_delete_android_bp
 test_add_file_to_soong_build
 test_soong_build_rerun_iff_environment_changes
+test_dump_json_module_graph