xref: /aosp_15_r20/external/ltp/doc/developers/documentation.rst (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker.. SPDX-License-Identifier: GPL-2.0-or-later
2*49cdfc7eSAndroid Build Coastguard Worker
3*49cdfc7eSAndroid Build Coastguard WorkerDocumentation
4*49cdfc7eSAndroid Build Coastguard Worker=============
5*49cdfc7eSAndroid Build Coastguard Worker
6*49cdfc7eSAndroid Build Coastguard WorkerThis section explains how to use and develop the LTP documentation. The current
7*49cdfc7eSAndroid Build Coastguard Workerdocumentation format is written using
8*49cdfc7eSAndroid Build Coastguard Worker`reStructedText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
9*49cdfc7eSAndroid Build Coastguard Workerand it's built on top of `Sphinx <https://www.sphinx-doc.org/en/master/>`_.
10*49cdfc7eSAndroid Build Coastguard Worker
11*49cdfc7eSAndroid Build Coastguard WorkerBuilding documentation
12*49cdfc7eSAndroid Build Coastguard Worker~~~~~~~~~~~~~~~~~~~~~~
13*49cdfc7eSAndroid Build Coastguard Worker
14*49cdfc7eSAndroid Build Coastguard WorkerFirst of all, to build the documentation we must be sure that all dependencies
15*49cdfc7eSAndroid Build Coastguard Workerhave been installed (please check :master:`doc/requirements.txt` file). Sometimes the
16*49cdfc7eSAndroid Build Coastguard WorkerLinux distros are providing them, but the best way is to use ``virtualenv``
17*49cdfc7eSAndroid Build Coastguard Workercommand as following:
18*49cdfc7eSAndroid Build Coastguard Worker
19*49cdfc7eSAndroid Build Coastguard Worker.. code-block:: bash
20*49cdfc7eSAndroid Build Coastguard Worker
21*49cdfc7eSAndroid Build Coastguard Worker    cd doc
22*49cdfc7eSAndroid Build Coastguard Worker
23*49cdfc7eSAndroid Build Coastguard Worker    # prepare virtual enviroment
24*49cdfc7eSAndroid Build Coastguard Worker    python3 -m virtualenv .venv
25*49cdfc7eSAndroid Build Coastguard Worker    . .venv/bin/activate
26*49cdfc7eSAndroid Build Coastguard Worker
27*49cdfc7eSAndroid Build Coastguard Worker    pip install sphinx # usually packaged in distros
28*49cdfc7eSAndroid Build Coastguard Worker    pip install -r requirements.txt
29*49cdfc7eSAndroid Build Coastguard Worker
30*49cdfc7eSAndroid Build Coastguard Worker    # build documentation
31*49cdfc7eSAndroid Build Coastguard Worker    make
32*49cdfc7eSAndroid Build Coastguard Worker
33*49cdfc7eSAndroid Build Coastguard WorkerOnce the procedure has been completed, documentation will be visible at
34*49cdfc7eSAndroid Build Coastguard Worker``doc/html/index.html``.
35*49cdfc7eSAndroid Build Coastguard Worker
36*49cdfc7eSAndroid Build Coastguard Worker.. warning::
37*49cdfc7eSAndroid Build Coastguard Worker
38*49cdfc7eSAndroid Build Coastguard Worker    The current :master:`.readthedocs.yml` workflow is using ``Python 3.6`` because
39*49cdfc7eSAndroid Build Coastguard Worker    older Python versions were causing issues. No other version has been tested,
40*49cdfc7eSAndroid Build Coastguard Worker    but it should work anyway.
41*49cdfc7eSAndroid Build Coastguard Worker
42*49cdfc7eSAndroid Build Coastguard WorkerValidating spelling
43*49cdfc7eSAndroid Build Coastguard Worker~~~~~~~~~~~~~~~~~~~
44*49cdfc7eSAndroid Build Coastguard Worker
45*49cdfc7eSAndroid Build Coastguard WorkerTo check documentation words spelling, we provide support for
46*49cdfc7eSAndroid Build Coastguard Worker`aspell <http://aspell.net/>`_, so make sure that it's installed. The
47*49cdfc7eSAndroid Build Coastguard Workerdocumentation can be tested via ``make spelling`` command. Output will be
48*49cdfc7eSAndroid Build Coastguard Workervisible in the ``doc/build`` folder and, if any error will be found, a warning
49*49cdfc7eSAndroid Build Coastguard Workermessage will be shown.
50*49cdfc7eSAndroid Build Coastguard Worker
51*49cdfc7eSAndroid Build Coastguard WorkerC API documentation
52*49cdfc7eSAndroid Build Coastguard Worker~~~~~~~~~~~~~~~~~~~
53*49cdfc7eSAndroid Build Coastguard Worker
54*49cdfc7eSAndroid Build Coastguard WorkerThe C API documentation is generated from headers using
55*49cdfc7eSAndroid Build Coastguard Worker`kernel-doc <https://return42.github.io/linuxdoc/linuxdoc-howto/kernel-doc-syntax.html>`_
56*49cdfc7eSAndroid Build Coastguard Workersyntax which is supported by Sphinx via
57*49cdfc7eSAndroid Build Coastguard Worker`linuxdoc <https://pypi.org/project/linuxdoc/>`_ extension.
58