diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-03 16:25:55 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-03 16:25:55 +0000 |
commit | c863bf09fe4aec435473d854e77b3195a6c27af1 (patch) | |
tree | 6fe5e059c32b178076242d9a6eef511ad3a986a8 /o3d/documentation | |
parent | 45cce3c01a447d2afa13e67426d9dd4fc7a91cfc (diff) | |
download | chromium_src-c863bf09fe4aec435473d854e77b3195a6c27af1.zip chromium_src-c863bf09fe4aec435473d854e77b3195a6c27af1.tar.gz chromium_src-c863bf09fe4aec435473d854e77b3195a6c27af1.tar.bz2 |
Generates a class hierarchy using graphviz "dot", the
same tool that doxygen uses.
This is not ready for primetime but I had already looked
at this and it didn't look to hard so I stuck it in.
With this CL nothing will happen unless graphviz is
added to third_party/graphviz/files but I wanted
to at least check in what has to happen so that if
someone else wants to finish it they can.
Basically jsdoctoolkit generates a .dot file that
lists the inheritance, that is passed to dot which
creates a png and a map file for a client side
image map. To actually use it online would require
inserting the map file into an html file, probably
using EZT or python.
Otherwise, to be useful we'd need to split the template
into ParamMatrix4 and its derived classes, Param and
its derived classes. RenderNode and its derived classes,
ParamObject and its derived classes and then finally
everything not covered by the above.
Otherwise the chart is too big.
http://www/~gman/images/class_hierarchy.png
To be honest though, given it's just a tree a simple
HTML page could also do this without the graphing.
Just a simple
-NamedObject
|
+-Param
|
+--ParamFloat
|
+--ParamInteger
etc.
Nearly as simple would be to save the data to JSON and
graph it in JavaScript live in the browser using
canvas or O3D. That would be a lot smaller than the 9meg
for the binary parts of graphviz
Review URL: http://codereview.chromium.org/174384
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25315 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/documentation')
-rw-r--r-- | o3d/documentation/build.scons | 1 | ||||
-rwxr-xr-x | o3d/documentation/build_docs.py | 21 | ||||
-rw-r--r-- | o3d/documentation/documentation.gyp | 1 | ||||
-rw-r--r-- | o3d/documentation/jsdoc-toolkit-templates/dot.tmpl | 21 | ||||
-rw-r--r-- | o3d/documentation/jsdoc-toolkit-templates/publish.js | 4 |
5 files changed, 48 insertions, 0 deletions
diff --git a/o3d/documentation/build.scons b/o3d/documentation/build.scons index 953490a..df0597e 100644 --- a/o3d/documentation/build.scons +++ b/o3d/documentation/build.scons @@ -62,6 +62,7 @@ if os.path.exists(env.subst(JSCOMP_PATH)): ['$JSDOC_EZT_TEMPLATE_DIR/annotated.tmpl', '$JSDOC_EZT_TEMPLATE_DIR/class.tmpl', '$JSDOC_EZT_TEMPLATE_DIR/classtree.tmpl', + '$JSDOC_EZT_TEMPLATE_DIR/dot.tmpl', '$JSDOC_EZT_TEMPLATE_DIR/filelist.tmpl', '$JSDOC_EZT_TEMPLATE_DIR/members.tmpl', '$JSDOC_EZT_TEMPLATE_DIR/namespaces.tmpl', diff --git a/o3d/documentation/build_docs.py b/o3d/documentation/build_docs.py index e3975d3..66f7e8e 100755 --- a/o3d/documentation/build_docs.py +++ b/o3d/documentation/build_docs.py @@ -88,6 +88,13 @@ def MakePath(*file_paths): return os.path.join(_script_path, *file_paths)
+def MakeCommandName(name):
+ """adds '.exe' if on Windows"""
+ if os.name == 'nt':
+ return name + '.exe'
+ return name
+
+
def UpdateGlobals(dict):
"""Copies pairs from dict into GlobalDict."""
for i, v in dict.items():
@@ -228,6 +235,19 @@ def BuildO3DDocsFromJavaScript(js_files, ezt_output_dir, html_output_dir): 'classo3d_1_1_', 'o3d', '', '', '')
+def BuildO3DClassHierarchy(html_output_dir):
+ # TODO(gman): We need to make mutliple graphs. One for Params, one for
+ # ParamMatrix4, one for RenderNode, one for everythng else.
+ dot_path = MakePath(_third_party_dir, 'graphviz', 'files', 'bin',
+ MakeCommandName('dot'))
+ if os.path.exists(dot_path):
+ Execute([
+ dot_path,
+ '-Tcmapx', '-o' + MakePath(html_output_dir, 'class_hierarchy.map'),
+ '-Tpng', '-o' + MakePath(html_output_dir, 'class_hierarchy.png'),
+ MakePath(html_output_dir, 'class_hierarchy.dot')])
+
+
def BuildO3DJSDocs(js_files, ezt_output_dir, html_output_dir, exports_file):
RunJSDocToolkit(js_files, ezt_output_dir, html_output_dir, 'js_1_0_', 'o3djs',
'jsdocs', '..', exports_file)
@@ -361,6 +381,7 @@ def main(argv): BuildJavaScriptForDocsFromIDLs(idl_files, docs_js_outpath)
BuildO3DDocsFromJavaScript([o3d_extra_externs_path] + docs_js_files,
o3d_docs_ezt_outpath, o3d_docs_html_outpath)
+ BuildO3DClassHierarchy(o3d_docs_html_outpath)
BuildJavaScriptForExternsFromIDLs(idl_files, externs_js_outpath)
BuildO3DExternsFile(externs_js_outpath,
o3d_extra_externs_path,
diff --git a/o3d/documentation/documentation.gyp b/o3d/documentation/documentation.gyp index b8db20b..19019ef 100644 --- a/o3d/documentation/documentation.gyp +++ b/o3d/documentation/documentation.gyp @@ -41,6 +41,7 @@ 'jsdoc-toolkit-templates/annotated.tmpl', 'jsdoc-toolkit-templates/class.tmpl', 'jsdoc-toolkit-templates/classtree.tmpl', + 'jsdoc-toolkit-templates/dot.tmpl', 'jsdoc-toolkit-templates/filelist.tmpl', 'jsdoc-toolkit-templates/members.tmpl', 'jsdoc-toolkit-templates/namespaces.tmpl', diff --git a/o3d/documentation/jsdoc-toolkit-templates/dot.tmpl b/o3d/documentation/jsdoc-toolkit-templates/dot.tmpl new file mode 100644 index 0000000..a669cb6 --- /dev/null +++ b/o3d/documentation/jsdoc-toolkit-templates/dot.tmpl @@ -0,0 +1,21 @@ +digraph G { + graph [ + rankdir = LR + ] + node [ + color = aquamarine + style = filled + shape = box + ] + edge [ + dir = back + ] + {! var allClasses = data.filter(function($){return !$.isNamespace}).sort(makeSortby("alias")); !} + <for each="thisClass" in="allClasses"> + <if test="thisClass.inheritsFrom.length"> + {+thisClass.inheritsFrom[0].replace('o3d.', '')+} -> {+thisClass.alias.replace('o3d.','')+} + {+thisClass.alias.replace('o3d.','')+} [URL="/apis/o3d/docs/reference/{+getBaseURL()+}{+getLinkToClassByAlias(thisClass.alias)+}"] + </if> + </for> +} + diff --git a/o3d/documentation/jsdoc-toolkit-templates/publish.js b/o3d/documentation/jsdoc-toolkit-templates/publish.js index 9fe8736..73057df 100644 --- a/o3d/documentation/jsdoc-toolkit-templates/publish.js +++ b/o3d/documentation/jsdoc-toolkit-templates/publish.js @@ -160,6 +160,7 @@ function publishInternal(symbolSet) { var annotatedTemplate = new JSDOC.JsPlate(templatesDir + 'annotated.tmpl'); var namespacesTemplate = new JSDOC.JsPlate(templatesDir + 'namespaces.tmpl'); + var dotTemplate = new JSDOC.JsPlate(templatesDir + 'dot.tmpl'); } catch(e) { generateError('Couldn\'t create the required templates: ' + e); System.exit(1); @@ -267,6 +268,9 @@ function publishInternal(symbolSet) { IO.saveFile(publish.conf.outDir, 'namespaces' + publish.conf.ext, namespaces); IO.saveFile(publish.conf.htmlDir, 'namespaces.html', namespaces); + var dot = dotTemplate.process(filteredClasses); + IO.saveFile(publish.conf.htmlDir, 'class_hierarchy.dot', dot); + if (publish.conf.exportsFile) { print("Writing exports: " + publish.conf.exportsFile); var blankLineRE = /\n *\n/gm; |