diff options
author | 2024-10-21 11:48:04 -0700 | |
---|---|---|
committer | 2024-10-21 11:48:04 -0700 | |
commit | 9f007c34cdb73681d5afd9c7253b42c3b83ae92a (patch) | |
tree | 453d8c7db8a8aa925f246f6768bcd1ea56e65bef /bin | |
parent | 130cbf6fc147d3be05bd65ff4cf0fdabaf1e4a91 (diff) |
Add a soongdbg star command, which prints dependencies in both directions.
Test: None
Bug: None
Change-Id: Ia8e56628159e4a61c498cfb6efbdb46e6938e7ea
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/soongdbg | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/bin/soongdbg b/bin/soongdbg index 98d31ebc9..080729136 100755 --- a/bin/soongdbg +++ b/bin/soongdbg @@ -393,12 +393,42 @@ class QueryCommand: print(f" dep: {d.id}") +class StarCommand: + help = "Print the dependencies and reverse dependencies of a module" + + def args(self, parser): + parser.add_argument("module", nargs="+", + help="Module to print dependencies of") + parser.add_argument("--depth", type=int, required=True, + help="max depth of dependencies") + print_args(parser) + + def run(self, args): + graph = load_graph() + nodes = set() + err = False + for id in args.module: + root = graph.nodes.get(id) + if not root: + sys.stderr.write(f"error: Can't find root: {id}\n") + err = True + continue + get_deps(nodes, root, args.depth, False, set(args.tag)) + nodes.remove(root) # Remove it so get_deps doesn't bail out + get_deps(nodes, root, args.depth, True, set(args.tag)) + if err: + sys.exit(1) + print_nodes(args, nodes, new_module_formatter(args)) + + + COMMANDS = { "between": BetweenCommand(), "deps": DepsCommand(), "id": IdCommand(), "json": JsonCommand(), "query": QueryCommand(), + "star": StarCommand(), } |