changeset 6506:305b9166b455

added projects table to the top level javadoc page generated by the site command
author Doug Simon <doug.simon@oracle.com>
date Thu, 04 Oct 2012 11:22:09 +0200
parents 1ecf984d490c
children 53006ba078d4
files graal/overview.html mx/commands.py mxtool/mx.py
diffstat 3 files changed, 50 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/graal/overview.html	Wed Oct 03 23:44:38 2012 +0200
+++ b/graal/overview.html	Thu Oct 04 11:22:09 2012 +0200
@@ -30,11 +30,11 @@
 </head>
 <body>
 
-<a href="modules.html" title="Click to enlarge"><img src="modules.jpg" width="400"/></a>
+<a href="projects.html" title="Click to enlarge"><img src="projects.jpg" width="400"/></a>
 <p>
 This document is the unified Javadoc for the Graal code base.
-The module dependency graph is shown above.
-Each node in the diagram is a link to the standalone Javadoc for the denoted module.
+The project dependency graph is shown above.
+Each node in the diagram is a link to the standalone Javadoc for the denoted project.
 <p>
 <a target="_top" href="http://openjdk.java.net/projects/graal/"><b>[go to the OpenJDK Graal project site]</b></a>
 
--- a/mx/commands.py	Wed Oct 03 23:44:38 2012 +0200
+++ b/mx/commands.py	Thu Oct 04 11:22:09 2012 +0200
@@ -1003,7 +1003,7 @@
                     '--jd', '@-tag', '--jd', '@vmoption:X',
                     '--overview', join(_graal_home, 'graal', 'overview.html'),
                     '--title', 'Graal OpenJDK Project Documentation',
-                    '--dot-output-base', 'modules'] + args)
+                    '--dot-output-base', 'projects'] + args)
 
 def mx_init():
     _vmbuild = 'product'
--- a/mxtool/mx.py	Wed Oct 03 23:44:38 2012 +0200
+++ b/mxtool/mx.py	Thu Oct 04 11:22:09 2012 +0200
@@ -1215,7 +1215,7 @@
         parser.add_argument('remainder', nargs=REMAINDER, metavar='...')
 
     args = parser.parse_args(args)
-
+    
     jdtJar = None
     if args.jdt is not None:
         if args.jdt.endswith('.jar'):
@@ -2430,6 +2430,26 @@
         javadoc(['--base', tmpbase] + exclude_packages_arg + projects_arg + extra_javadoc_args)
 
         # Create unified javadoc for all projects
+        with open(args.overview) as fp:
+            content = fp.read()
+            idx = content.rfind('</body>')
+            if idx != -1:
+                args.overview = join(tmpbase, 'overview_with_projects.html')
+                with open(args.overview, 'w') as fp2:
+                    print >> fp2, content[0:idx]
+                    print >> fp2, """<div class="contentContainer">
+<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Projects table">
+<caption><span>Projects</span><span class="tabEnd">&nbsp;</span></caption>
+<tr><th class="colFirst" scope="col">Project</th><th class="colLast" scope="col">&nbsp;</th></tr>
+<tbody>"""
+                    color = 'row'
+                    for p in projects:
+                        print >> fp2, '<tr class="{1}Color"><td class="colFirst"><a href="../{0}/javadoc/index.html", target = "_top">{0}</a></td><td class="colLast">&nbsp;</td></tr>'.format(p.name, color)
+                        color = 'row' if color == 'alt' else 'alt'
+                        
+                    print >> fp2, '</tbody></table></div>'
+                    print >> fp2, content[idx:]
+        
         title = args.title if args.title is not None else args.name
         javadoc(['--base', tmpbase,
                  '--unified',
@@ -2440,6 +2460,18 @@
 
         # Generate dependency graph with Graphviz
         if args.dot_output_base is not None:
+            dotErr = None
+            try:
+                if not 'version' in subprocess.check_output(['dot', '-V'], stderr=subprocess.STDOUT):
+                    dotErr = 'dot -V does not print a string containing "version"'
+            except subprocess.CalledProcessError as e:
+                dotErr = 'error calling "dot -V": {}'.format(e) 
+            except OSError as e:
+                dotErr = 'error calling "dot -V": {}'.format(e)
+                 
+            if dotErr != None:
+                abort('cannot generate dependency graph: ' + dotErr)
+
             dot = join(tmpbase, 'all', str(args.dot_output_base) + '.dot')
             svg = join(tmpbase, 'all', str(args.dot_output_base) + '.svg')
             jpg = join(tmpbase, 'all', str(args.dot_output_base) + '.jpg')
@@ -2461,21 +2493,21 @@
                     d = p.max_depth()
                     depths.setdefault(d, list()).append(p.name)
                 print >> fp, '}'
-
+    
             run(['dot', '-Tsvg', '-o' + svg, '-Tjpg', '-o' + jpg, dot])
 
-        # Post-process generated SVG to remove title elements which most browsers
-        # render as redundant (and annoying) tooltips.
-        with open(svg, 'r') as fp:
-            content = fp.read()
-        content = re.sub('<title>.*</title>', '', content)
-        content = re.sub('xlink:title="[^"]*"', '', content)
-        with open(svg, 'w') as fp:
-            fp.write(content)
-
-        # Create HTML that embeds the svg file in an <object> frame
-        with open(html, 'w') as fp:
-            print >> fp, '<html><body><object data="modules.svg" type="image/svg+xml"></object></body></html>'
+            # Post-process generated SVG to remove title elements which most browsers
+            # render as redundant (and annoying) tooltips.
+            with open(svg, 'r') as fp:
+                content = fp.read()
+            content = re.sub('<title>.*</title>', '', content)
+            content = re.sub('xlink:title="[^"]*"', '', content)
+            with open(svg, 'w') as fp:
+                fp.write(content)
+        
+            # Create HTML that embeds the svg file in an <object> frame
+            with open(html, 'w') as fp:
+                print >> fp, '<html><body><object data="{}.svg" type="image/svg+xml"></object></body></html>'.format(args.dot_output_base)
 
         top = join(tmpbase, 'all', 'overview-summary.html')
         for root, _, files in os.walk(tmpbase):