New issue
Advanced search Search tips

Issue 620132 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Aug 2016
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

GN feature request: JSON export

Project Member Reported by brettw@chromium.org, Jun 14 2016

Issue description

Various people and projects have wanted dependency tree information out of GN programatically.

This does not block anything from the GN team's perspective, but is a frequently requested feature.

From a user perspective, I'm thinking of adding a flag to "gn desc" to control formatting:
  gn desc --format=json out/foo //base:base
Would dump the summary of base in JSON format to stdout.

"gn desc" also supports wildcards, so to dump all projects would be:
  gn desc --format=json out/foo "//*"

Implementation-wise, I'm thinking all of the computation code in command_deps would be changed to fill base::Values instead of print to stdout. There is already a serializer from base::Value to JSON. For the current behavior, we write a simple JSON-to-indented text output function there. This way the code paths are all the same for the different output formats.

The only interesting parts are deciding how to implement the more complex things which are --blame (lots of annotations for various groups) and the --tree mode of deps (indentation). It could be we just serialize to strings that "look right" and assume people won't care about this information in JSON format.
 
Proof of concept

https://codereview.chromium.org/2064533002/

With thing missing - I still have to implement the --format=json flag in gn desc (even though internally it already uses base::Values, it just always prints it formatted)
With latest patchset --format=json should work

Comment 3 by brettw@chromium.org, Aug 17 2016

Status: Fixed (was: Available)
This is done

Sign in to add a comment