From 23cf8079e7f45d1dc3595ba4182ac1c9d6f9bd34 Mon Sep 17 00:00:00 2001 From: "David B. Kinder" Date: Mon, 24 Sep 2018 13:15:50 -0700 Subject: [PATCH] doc: update tagged release doc build instructions Update the doc build instructions to include how to update the version navigation selector (bottom of the left nav panel), and make commands for building and publishing specific tagged releases (e.g., 0.2) Signed-off-by: David B. Kinder --- doc/tutorials/docbuild.rst | 104 +++++++++++++++++++++++++++++-------- 1 file changed, 82 insertions(+), 22 deletions(-) diff --git a/doc/tutorials/docbuild.rst b/doc/tutorials/docbuild.rst index 5536252c5..1f3ba0544 100644 --- a/doc/tutorials/docbuild.rst +++ b/doc/tutorials/docbuild.rst @@ -25,12 +25,14 @@ The project's documentation contains the following items: * ReStructuredText source files used to generate documentation found at the http://projectacrn.github.io website. All of the reStructuredText sources - are found in this acrn-documentation repo. + are found in the acrn-hypervisor/doc folder, or pulled in from sibling + folders (such as /tools/) by the build scripts. * Doxygen-generated material used to create all API-specific documents - found at http://projectacrn.github.io/api/. Source files from the - acrn-hypervisor/hypervisor and acrn-hypervisor/devicemodel repos are also used to access the - header files for the the public APIs, but more about that later. + found at http://projectacrn.github.io/latest/api/. The doc build + process uses doxygen to scan source files in the hypervisor and + device-model folders, and from sources in the acrn-kernel repo (as + explained later). The reStructuredText files are processed by the Sphinx documentation system, and make use of the breathe extension for including the doxygen-generated API @@ -55,9 +57,8 @@ You'll need git installed to get the working folders set up: sudo dnf install git We use the source header files to generate API docs and we use github.io -for publishing the generated documentation. -Here's the recommended folder setup for documentation contributions and -generation: +for publishing the generated documentation. Here's the recommended +folder setup for documentation contributions and generation: .. code-block: none @@ -66,7 +67,7 @@ generation: devicemodel/ doc/ hypervisor/ - acrn-kernel + acrn-kernel/ The parent projectacrn folder is there because we'll also be creating a publishing area later in these steps. For API doc generation, we'll also @@ -111,11 +112,11 @@ repos (though https clones work too): .. note:: We assume for doc generation that ``origin`` is pointed to the upstream repo. If you're a developer and have the acrn-kernel - repo allready set up as a sibling folder to the acrn-hypervisor, + repo already set up as a sibling folder to the acrn-hypervisor, you can skip this clone step. -#. If you haven't do so already, be sure to configure git with your name - and email address for the signed-off-by line in your commit messages: +#. If you haven't done so already, be sure to configure git with your name + and email address for the ``signed-off-by`` line in your commit messages: .. code-block:: bash @@ -164,15 +165,28 @@ Documentation presentation theme Sphinx supports easy customization of the generated documentation appearance through the use of themes. Replace the theme files and do -another ``make html`` and the output layout and style is changed. +another ``make html`` and the output layout and style is changed. The +sphinx build system creates document cache information that attempts to +expedite doc rebuilds, but occasionally can cause an unexpected error or +warning to be generated. Doing a ``make clean`` to create a clean doc +generation and a ``make html`` again generally cleans this up. + The ``read-the-docs`` theme is installed as part of the -``requirements.txt`` list above. +``requirements.txt`` list above. Tweaks to the standard +``read-the-docs`` look and feel are added by using CSS +and JavaScript customization found in ``doc/static``, and +theme template overrides found in ``doc/_templates``. Running the documentation processors ************************************ -The acrn-hypervisor/doc directory has all the .rst source files, extra tools, and Makefile for -generating a local copy of the ACRN technical documentation. +The acrn-hypervisor/doc directory has all the .rst source files, extra +tools, and Makefile for generating a local copy of the ACRN technical +documentation. For generating all the API documentation, there is a +dependency on having the ``acrn-kernel`` repo's contents available too +(as described previously). You'll get a sphinx warning if that repo is +not set up as described, but you can be ignore that warning if you're +not planning to publish. .. code-block:: bash @@ -181,7 +195,16 @@ generating a local copy of the ACRN technical documentation. Depending on your development system, it will take about 15 seconds to collect and generate the HTML content. When done, you can view the HTML -output with your browser started at ``~/projectacrn/acrn-hypervisor/doc/_build/html/index.html`` +output with your browser started at +``~/projectacrn/acrn-hypervisor/doc/_build/html/index.html``. You can +also ``cd`` to the ``doc/_build/html`` folder and run a local web server +with the command: + +.. code-block:: bash + + python3 -m http.server + +and use your web browser to open the URL: ``http://localhost:8000``. Publishing content ****************** @@ -206,11 +229,48 @@ good, you can push directly to the publishing site with: make publish This will delete everything in the publishing repo's **latest** folder -(in case the new version has -deleted files) and push a copy of the newly-generated HTML content -directly to the GitHub pages publishing repo. The public site at -https://projectacrn.github.io will be updated (nearly) immediately -so it's best to verify the locally generated html before publishing. +(in case the new version has deleted files) and push a copy of the +newly-generated HTML content directly to the GitHub pages publishing +repo. The public site at https://projectacrn.github.io will be updated +(nearly) immediately so it's best to verify the locally generated html +before publishing. + +Document Versioning +******************* + +The https://projectacrn.github.io site has a document version selector +at the bottom of the left nav panel. The contents of this version +selector are defined in the ``conf.py`` sphinx configuration file, +specifically: + +.. code-block:: python + + html_context = { + 'current_version': current_version, + 'versions': ( ("latest", "/latest/"), + ("0.2", "/0.2/"), + ("0.1", "/0.1/"), + ) + } + +As new versions of documentation are added, this ``versions`` selection +list should be updated to include the version number and publishing +folder. Note that there's no direct selection to go to a newer version +from an older one, without going to ``latest`` first. + +By default, doc build and publishing assumes we're generating +documentation for the master branch and publishing to the ``/latest/`` +area on https://projectacrn.github.io. When we're generating the +documentation for a tagged version (e.g., 0.2), check out that version +of the repo, and add some extra flags to the make commands: + +.. code-block:: bash + + cd ~/projectacrn/acrn-hypervisor/doc + git checkout v0.2 + make clean + make DOC_TAG=release RELEASE=0.2 html + make DOC_TAG=release RELEASE=0.2 publish Filtering expected warnings *************************** @@ -230,7 +290,7 @@ filtering is done as part of the ``Makefile``.) If you're contributing components included in the ACRN API documentation and run across these warnings, you can include filtering -them out as "expected" warnings by adding a conf file to the +them out as "expected" warnings by adding or editing a conf file in the ``.known-issues/doc`` folder, following the example of other conf files found there.