Commit graph

82 commits

Author SHA1 Message Date
Carles Cufi a580b3d174 west: Fix handling of modules in the boards command
The boards command was not properly using the zephyr_module
functionality to obtain the board roots of all modules. Fix that by
moving the functionality required to the core zephyr_module file and
reuse it from external scripts.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-08-09 16:07:51 +02:00
Kumar Gala 412d835448 doc: generate dummy Kconfig.dts
Generate a dummy Kconfig.dts to allow docs to build

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 09:39:49 -07:00
Gerard Marull-Paretas 46fb9509bf doc: extensions: kconfig: handle promptless choices showing as parents
Promptless choices can show up as parents when, e.g., people define
choices in multiple locations, including modules. Render them using the
built-in Kconfig expression to string formatter, so that they show up as
'<choice (...)>'.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:18:24 +02:00
Gerard Marull-Paretas d0bb8deaaf doc: extensions: kconfig: render menu path
Render the menu path where an option can be found. For example,

CONFIG_SPI: (Top) > Device Drivers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-06 20:54:59 -07:00
Gerard Marull-Paretas c980f0490f doc: extensions: kconfig: add support for selected/implied by
This patch adds support for displaying the "selected by" and "implied
by" entries in the Kconfig search extension, ie, reverse dependencies.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-06 20:54:59 -07:00
Nazar Kazakov f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Torsten Rasmussen 5a82b537b3 doc: remove space between argument and build folder
When using `zephyr-app-command` the CMake arguments and values are not
having spaces between them, except the `-B build`.

Remove the space, so that `-B build` becomes `-Bbuild` and thus looks
similar to other `-<arg><value>` occurences.

Example before this commit:
> Use cmake to configure a Ninja-based buildsystem:
> cmake -B build -GNinja -DBOARD=reel_board samples/hello_world
>
> Now run ninja on the generated build system:
> ninja -C build

With this commit:
> Use cmake to configure a Ninja-based buildsystem:
> cmake -Bbuild -GNinja -DBOARD=reel_board samples/hello_world
>
> Now run ninja on the generated build system:
> ninja -Cbuild

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-03-16 10:24:53 +01:00
Gerard Marull-Paretas 483585b6dd doc: delete old kconfig scripts and extensions
These are no longer used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-02 09:28:37 +01:00
Gerard Marull-Paretas 8bdeac62bb doc: extensions: add kconfig search extension
Add a new extension to handle Kconfig documentation. This means that no
more CMake hackery is required. However, the way it works differs from
the current approach. Instead of creating a single page for each Kconfig
option, the extension creates a JSON "database" which is then used on
the client side to render Kconfig options on a search page. The reason
to go for a single page choice is because Sphinx is significantly slow
when handling a lot of pages. Kconfig was responsible for an increase of
about ~10K pages.

Main features:

- Generates a Kconfig JSON database using kconfiglib APIs.
- Adds a new Sphinx domain for Kconfig. The domain provides a directive,
  :kconfig:search:: that can be used to insert a Kconfig search box onto
  any page. This page is where all Kconfig references inserted using the
  :kconfig:option: role will point to. The search functionality is
  implemented on the client side using Javascript. If the URL contains a
  hash with a Kconfig option (e.g. #CONFIG_SPI) it will load it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-02 09:28:37 +01:00
Gerard Marull-Paretas 956d49ad66 doc: extensions: doxyrunner: do not modify extension config
After the introduction of #41688, doxyrunner extension modifies the
fmt_vars content (from a variable defined in `conf.py`) when the output
directory variable is defined. This means that Sphinx will always get an
outdated environment and so will always perform a full build instead of
an incremental build. This patch makes a copy first to prevent this
situation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-05 06:24:26 -05:00
Gerard Marull-Paretas 7e88a29a7e doc: extensions: doxyrunner: add doxyrunner_outdir_var option
The doxyrunner_outdir_var option allows to specify which variable (if
any) is used to represent the output directory (as used by
OUTPUT_DIRECTORY). This makes sure that other options referencing it are
processed correctly, since the output directory is not passed as a
variable.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-18 13:14:05 -05:00
Gerard Marull-Paretas aceed99e2d doc: extensions: link-roles: hide stderr for git describe
Redirect stderr to DEVNULL when running `git describe --exact-match`.
This prevents messages like "fatal: No names found, cannot describe
anything." to be shown.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-10 16:48:43 -05:00
Gerard Marull-Paretas 569b794d4b doc: extensions: vcs_link: only run for HTML builder
The vcs_link should only run for the HTML builder, since it is the only
target of this extension. The other builders do not have the templates
instance, making them fail.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-10-26 18:01:32 -04:00
Gerard Marull-Paretas 1e79096d9a doc: extensions: add vcs_link
Add vcs_link extension. The extension can be used to obtain VCS (Git)
URLs for given Sphinx documents.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-10-26 17:00:56 +02:00
Martí Bolívar 8eeac3e259 doc: link-roles: clean up setup() method
The setup() method is trying to find the zephyr repository by name,
but it's not passing allow_paths=False to the west method it uses to
search.

That may lead to unpredictable results depending on what the current
working directory is in the calling environment.

For robustness, disallow paths and make sure we are only searching for
the zephyr project by name.

Add some more comments to explain what is going on and clean up the
empty string handling while we're here.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-09 13:29:57 -04:00
Gerard Marull-Paretas 280b5f3256 doc: extensions: link-roles: remove usage of local_util
local_util module is no longer used by other extensions, so remove its
usage.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-19 20:06:00 -04:00
Gerard Marull-Paretas 5e82764cb3 doc: extensions: doxyrunner: fix HTML output handling
The extension was not evaluating the GENERATE_HTML option correctly. The
get_doxygen_option returns a `List[str]`, not a `str`.

This effectively means that the Zephyr apidoc has not been updated for a
while as the extension was not moving the output to the final
destination folder.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-15 06:57:02 -04:00
Gerard Marull-Paretas 4fcec51c2a doc: extensions: doxyrunner: handle quiet mode
QUIET flag is now overriden according to the `doxyrunner_silent`
configuration value.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-13 17:36:15 +02:00
Gerard Marull-Paretas 85a0e1325c doc: extensions: doxyrunner: process Doxygen output
This change will process Doxygen output and will map it to the Sphinx
logger. Things like errors and warnings will be mapped to actual Sphinx
logger error and warnings. In practice this means that when Doxygen
throws a warning and Sphinx is run in "-W" (warning as error) mode, the
build will fail. It also has some other advantages such as the
possibility of filtering issues using the warnings_filter extension.

It is also expected that CI errors not being displayed issue is fixed
with this change.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-13 17:36:15 +02:00
Gerard Marull-Paretas 21d01ad7d1 doc: extensions: add kconfig directive and role support
Add a new extension to support the :kconfig: role and .. kconfig::
directive. This removes the need of using :option:.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-06-29 10:26:28 -04:00
Gerard Marull-Paretas da62a3b6c0 doc: extensions: doxyrunner: store cache in Sphinx environment
Sphinx provides a way to persist data across builds: the
BuildEnvironment. The build environment is automatically managed by
Sphinx, so there is no need to take care of loading/dumping cache files.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-06-17 10:28:59 +02:00
Gerard Marull-Paretas b0ca352dfe doc: extensions: doxyrunner: use file hashes for cache
Use file hashes instead of paths and modification times. This method is
fits better on systems using cache mechanisms. Note that hash is
computed using content obtained in UTF-8 text mode for portability
reasons.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-06-17 10:28:59 +02:00
Martí Bolívar 9464798068 doc: external_content: fix for Unix
Path.rename() uses os.rename() internally. Per the Python docs:

     The operation may fail on some Unix flavors if src and dst are on
     different filesystems.

Since 'src_adjusted' is in a temporary directory, on my flavor of
Unix, that's in /tmp, which is indeed on a different filesystem than
'dst', a destination in the doc build directory on my root filesystem.

This is causing the following error when I build the docs:

Handler <function sync_contents at 0x7f9b8fca9c10> for event
'builder-inited' threw an exception (exception: [Errno 18] Invalid
cross-device link: '/tmp/tmpfscfo20o/index.rst' ->
'/home/mbolivar/zp/zephyr/doc/_build/src/reference/drivers/index.rst')

Fix this by using shutil.move() instead of Path.rename(). The shutil
function handles cross-filesystem moves correctly. It did not take a
path-like object for both its src and dst arguments until Python 3.9,
though, so we need to convert to strings for portability on earlier
but still supported versions.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-28 07:00:52 -05:00
Gerard Marull-Paretas de3c086429 doc: extensions: external_content: only ignore absolute paths
When including other rst files (via .. include::) the existence of the
included file may depend on when the _adjust routine is called, so only
ignore absolute paths.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-25 16:14:31 -05:00
Gerard Marull-Paretas f341466681 doc: extensions: doxyrunner: use string paths on pickle file
PosixPath or WindowsPaths are not portable, so using them on pickle
files, which can potentially be re-used is not safe. Changed to use the
posix path as a string.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-25 16:14:18 -05:00
Gerard Marull-Paretas cc2f29a656 doc: extensions: initial version of external_content
external_content extension allows to gather content from arbitrary
locations.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-25 19:38:11 +02:00
Martí Bolívar 095c9a3e92 doc: link-roles: fix :zephyr_file: default revision
This needs to use 'main' for its default now.

Without this patch, GitHub redirects to main, but displays a banner
that says 'Branch not found, redirected to default branch' at the top.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-21 18:10:13 -04:00
Gerard Marull-Paretas 07a5cd5322 doc: extensions: doxyrunner: make html output optional
Make HTML output optional. The extension checks the `GENERATE_HTML`
option to check if active.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-20 19:57:20 +02:00
Gerard Marull-Paretas bff24fa732 doc: extensions: add doxyrunner
zephyr.doxyrunner Sphinx extension is meant to replace multiple Python
and CMake scripts into a single Sphinx extension.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-06 13:19:19 +02:00
Gerard Marull-Paretas 74783c1976 doc: extensions: add warnings_filter
warnings_filter is an extension that allows to filter out Sphinx
warnings.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-07 14:15:29 +02:00
Gerard Marull-Paretas 6bf3363089 doc: add comment to empty Python files
Explicitely mention that these files are intentionally empty. These
changes should make compliance checks pass.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-03-31 10:39:48 +02:00
Gerard Marull-Paretas 38b1f7a15e doc: move extensions to _extensions
Move all Sphinx related content to folders prefixed with an underscore.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-03-31 10:39:48 +02:00