comparison 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
comparison
equal deleted inserted replaced
22157:00844f943607 22158:4f56b2984531
3836 3836
3837 def projectgraph(args, suite=None): 3837 def projectgraph(args, suite=None):
3838 """create graph for project structure ("mx projectgraph | dot -Tpdf -oprojects.pdf" or "mx projectgraph --igv")""" 3838 """create graph for project structure ("mx projectgraph | dot -Tpdf -oprojects.pdf" or "mx projectgraph --igv")"""
3839 3839
3840 parser = ArgumentParser(prog='mx projectgraph') 3840 parser = ArgumentParser(prog='mx projectgraph')
3841 parser.add_argument('--dist', action='store_true', help='group projects by distribution')
3841 parser.add_argument('--igv', action='store_true', help='output to IGV listening on 127.0.0.1:4444') 3842 parser.add_argument('--igv', action='store_true', help='output to IGV listening on 127.0.0.1:4444')
3842 parser.add_argument('--igv-format', action='store_true', help='output graph in IGV format') 3843 parser.add_argument('--igv-format', action='store_true', help='output graph in IGV format')
3843 3844
3844 args = parser.parse_args(args) 3845 args = parser.parse_args(args)
3845 3846
3885 return 3886 return
3886 3887
3887 print 'digraph projects {' 3888 print 'digraph projects {'
3888 print 'rankdir=BT;' 3889 print 'rankdir=BT;'
3889 print 'node [shape=rect];' 3890 print 'node [shape=rect];'
3891 if args.dist:
3892 projs = {}
3893 for d in sorted_dists():
3894 if not d.isProcessorDistribution:
3895 print 'subgraph "cluster_' + d.name + '" {'
3896 print 'label="' + d.name + '";'
3897 for p in d.sorted_deps(includeLibs=False, transitive=True):
3898 if p in projs:
3899 if not projs[p] in d.get_dist_deps(includeSelf=False, transitive=True):
3900 raise RuntimeError('ERROR: project ' + p.name + ' in two dists: ' + projs[p].name + ' and ' + d.name)
3901 else:
3902 projs[p] = d
3903 print '"' + p.name + '";'
3904 print '}'
3890 for p in projects(): 3905 for p in projects():
3891 for dep in p.canonical_deps(): 3906 for dep in p.canonical_deps():
3892 print '"' + p.name + '"->"' + dep + '";' 3907 print '"' + p.name + '"->"' + dep + '";'
3893 if hasattr(p, '_declaredAnnotationProcessors'): 3908 if hasattr(p, '_declaredAnnotationProcessors'):
3894 for ap in p._declaredAnnotationProcessors: 3909 for ap in p._declaredAnnotationProcessors: