Mercurial > hg > graal-compiler
diff mxtool/mx.py @ 22158:4f56b2984531
mx: Option to show distributions in 'mx projectgraph'.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Tue, 07 Jul 2015 11:55:52 +0200 |
parents | 32434ca987d7 |
children | 73366ceb98a8 |
line wrap: on
line diff
--- a/mxtool/mx.py Mon Jul 06 23:06:41 2015 -0700 +++ b/mxtool/mx.py Tue Jul 07 11:55:52 2015 +0200 @@ -3838,6 +3838,7 @@ """create graph for project structure ("mx projectgraph | dot -Tpdf -oprojects.pdf" or "mx projectgraph --igv")""" parser = ArgumentParser(prog='mx projectgraph') + parser.add_argument('--dist', action='store_true', help='group projects by distribution') parser.add_argument('--igv', action='store_true', help='output to IGV listening on 127.0.0.1:4444') parser.add_argument('--igv-format', action='store_true', help='output graph in IGV format') @@ -3887,6 +3888,20 @@ print 'digraph projects {' print 'rankdir=BT;' print 'node [shape=rect];' + if args.dist: + projs = {} + for d in sorted_dists(): + if not d.isProcessorDistribution: + print 'subgraph "cluster_' + d.name + '" {' + print 'label="' + d.name + '";' + for p in d.sorted_deps(includeLibs=False, transitive=True): + if p in projs: + if not projs[p] in d.get_dist_deps(includeSelf=False, transitive=True): + raise RuntimeError('ERROR: project ' + p.name + ' in two dists: ' + projs[p].name + ' and ' + d.name) + else: + projs[p] = d + print '"' + p.name + '";' + print '}' for p in projects(): for dep in p.canonical_deps(): print '"' + p.name + '"->"' + dep + '";'