README.md
1# JSON module graph queries
2
3This directory contains `jq` scripts that query Soong's module graph.
4
5It uses the JSON module graph that Soongs dumps when the
6`SOONG_DUMP_JSON_MODULE_GRAPH` environment variable is set.
7
8Usage:
9
10```
11SOONG_DUMP_JSON_MODULE_GRAPH=<some file> m nothing
12query.sh [-C] <command> <some file> [argument]
13```
14
15The following commands are available:
16* `printModule` prints all variations of a given module
17* `filterSubtree` dumps only those modules that are in the given subtree of the
18 source tree
19* `directDeps` prints the names of the direct dependencies of the given module
20* `transitiveDeps` prints the names of the transitive dependencies of the given
21 module
22* `fullTransitiveDeps` returns the full transitive dependencies of the given
23 module
24* `distanceFromLeaves` prints the longest distance each module has from a leaf
25 in the module graph within the transitive closure of given module
26* `usedVariations` returns a map that shows which variations are used in the
27 input and what values they take
28* `variantTransitions` summarizes the variant transitions in the transitive
29 closure of the given module
30
31It's best to filter the full module graph to the part you are interested in
32because `jq` isn't too fast on the full graph.
33