Bug 1389341 - add basic support for sphinx-js to mach doc r?gps draft
authorRobert Helmer <rhelmer@mozilla.com>
Thu, 24 Aug 2017 19:09:49 -0700
changeset 656717 4d4d9807674c9f8509e4a7b52f73383e4e009205
parent 652622 2306e153fba9ca55726ffcce889eaca7a479c29f
child 656718 3292c3659887c4b0aad18621b84d296d61965810
push id77299
push userbmo:rhelmer@mozilla.com
push dateThu, 31 Aug 2017 15:52:21 +0000
reviewersgps
bugs1389341
milestone57.0a1
Bug 1389341 - add basic support for sphinx-js to mach doc r?gps MozReview-Commit-ID: L2Xa2onqpzh
tools/docs/conf.py
tools/docs/jsdoc.json
tools/docs/mach_commands.py
--- a/tools/docs/conf.py
+++ b/tools/docs/conf.py
@@ -31,18 +31,25 @@ sys.path[:0] = [os.path.join(topsrcdir, 
 
 sys.path.insert(0, OUR_DIR)
 
 extensions = [
     'sphinx.ext.autodoc',
     'sphinx.ext.graphviz',
     'sphinx.ext.todo',
     'mozbuild.sphinx',
+    'sphinx_js',
 ]
 
+# JSDoc must run successfully for dirs specified, so running
+# tree-wide (the default) will not work currently.
+js_source_path = []
+root_for_relative_js_paths = '.'
+jsdoc_config_path = 'tools/docs/jsdoc.json'
+
 templates_path = ['_templates']
 source_suffix = '.rst'
 master_doc = 'index'
 project = u'Mozilla Source Tree Docs'
 year = datetime.now().year
 
 # Grab the version from the source tree's milestone.
 # FUTURE Use Python API from bug 941299.
new file mode 100644
--- /dev/null
+++ b/tools/docs/jsdoc.json
@@ -0,0 +1,5 @@
+{
+  "source": {
+    "includePattern": ".+\\.jsm$"
+  }
+}
--- a/tools/docs/mach_commands.py
+++ b/tools/docs/mach_commands.py
@@ -31,17 +31,18 @@ class Documentation(MachCommandBase):
     @CommandArgument('--outdir', default=None, metavar='DESTINATION',
         help='Where to write output.')
     @CommandArgument('--no-open', dest='auto_open', default=True, action='store_false',
         help="Don't automatically open HTML docs in a browser.")
     @CommandArgument('--http', const=':6666', metavar='ADDRESS', nargs='?',
         help='Serve documentation on an HTTP server, e.g. ":6666".')
     def build_docs(self, what=None, format=None, outdir=None, auto_open=True, http=None):
         self._activate_virtualenv()
-        self.virtualenv_manager.install_pip_package('sphinx_rtd_theme==0.1.6')
+        self.virtualenv_manager.install_pip_package('sphinx_rtd_theme==0.2.4')
+        self.virtualenv_manager.install_pip_package('sphinx-js==2.1')
 
         import sphinx
         import webbrowser
 
         if not outdir:
             outdir = os.path.join(self.topobjdir, 'docs')
         if not what:
             what = [os.path.join(self.topsrcdir, 'tools')]