aboutsummaryrefslogtreecommitdiff
path: root/doc/internal-api
diff options
context:
space:
mode:
authorOlivia Crain <olivia@olivia.dev>2024-09-24 13:10:06 -0500
committerOlivia Crain <olivia@olivia.dev>2024-09-24 13:26:22 -0500
commit2f794733b2af153ff0f6b7ba3a963d84d63c0e03 (patch)
tree8ab70391b06a0f8c79179c3a8b53f4c8c92f3dcd /doc/internal-api
parent5f298f74c92402a8390b01c736463b17b36277e3 (diff)
internal-api-docs: allow Doxygen to build regardless of workdir
Previously, Doxygen needed to be ran from the project's source root dir due to the relative paths in the config's `INPUT` tag. We now preprocess the relative paths by prefixing them with the absolute path of the project's source root dir. The HTML output remains unchanged. Fixes: https://git.lix.systems/lix-project/lix/issues/240 Change-Id: I85f099c22bfc5fdbf26be27c2db7dcbc8155c8b2
Diffstat (limited to 'doc/internal-api')
-rw-r--r--doc/internal-api/doxygen.cfg.in39
-rw-r--r--doc/internal-api/meson.build46
2 files changed, 49 insertions, 36 deletions
diff --git a/doc/internal-api/doxygen.cfg.in b/doc/internal-api/doxygen.cfg.in
index 73fba6948..662fb4333 100644
--- a/doc/internal-api/doxygen.cfg.in
+++ b/doc/internal-api/doxygen.cfg.in
@@ -33,32 +33,7 @@ GENERATE_LATEX = NO
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-# FIXME Make this list more maintainable somehow. We could maybe generate this
-# in the Makefile, but we would need to change how `.in` files are preprocessed
-# so they can expand variables despite configure variables.
-
-INPUT = \
- src/libcmd \
- src/libexpr \
- src/libexpr/flake \
- tests/unit/libexpr \
- tests/unit/libexpr/value \
- tests/unit/libexpr/test \
- tests/unit/libexpr/test/value \
- src/libexpr/value \
- src/libfetchers \
- src/libmain \
- src/libstore \
- src/libstore/build \
- src/libstore/builtins \
- tests/unit/libstore \
- tests/unit/libstore/test \
- src/libutil \
- tests/unit/libutil \
- tests/unit/libutil/test \
- src/nix \
- src/nix-env \
- src/nix-store
+INPUT = @INPUT_PATHS@
# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
# in the source code. If set to NO, only conditional compilation will be
@@ -97,3 +72,15 @@ EXPAND_AS_DEFINED = \
DECLARE_WORKER_SERIALISER \
DECLARE_SERVE_SERIALISER \
LENGTH_PREFIXED_PROTO_HELPER
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH = "@PROJECT_SOURCE_ROOT@"
diff --git a/doc/internal-api/meson.build b/doc/internal-api/meson.build
index faa30f194..af93b6943 100644
--- a/doc/internal-api/meson.build
+++ b/doc/internal-api/meson.build
@@ -1,3 +1,35 @@
+internal_api_sources = [
+ 'src/libcmd',
+ 'src/libexpr',
+ 'src/libexpr/flake',
+ 'tests/unit/libexpr',
+ 'tests/unit/libexpr/value',
+ 'tests/unit/libexpr/test',
+ 'tests/unit/libexpr/test/value',
+ 'src/libexpr/value',
+ 'src/libfetchers',
+ 'src/libmain',
+ 'src/libstore',
+ 'src/libstore/build',
+ 'src/libstore/builtins',
+ 'tests/unit/libstore',
+ 'tests/unit/libstore/test',
+ 'src/libutil',
+ 'tests/unit/libutil',
+ 'tests/unit/libutil/test',
+ 'src/nix',
+ 'src/nix-env',
+ 'src/nix-store',
+]
+
+# We feed Doxygen absolute paths so it can be invoked from any working directory.
+internal_api_sources_absolute = []
+foreach src : internal_api_sources
+ internal_api_sources_absolute += '"' + (meson.project_source_root() / src) + '"'
+endforeach
+
+internal_api_sources_oneline = ' \\\n '.join(internal_api_sources_absolute)
+
doxygen_cfg = configure_file(
input : 'doxygen.cfg.in',
output : 'doxygen.cfg',
@@ -5,22 +37,16 @@ doxygen_cfg = configure_file(
'PACKAGE_VERSION': meson.project_version(),
'RAPIDCHECK_HEADERS': rapidcheck_meson.get_variable('includedir'),
'docdir' : meson.current_build_dir(),
+ 'INPUT_PATHS' : internal_api_sources_oneline,
+ 'PROJECT_SOURCE_ROOT' : meson.project_source_root(),
},
)
internal_api_docs = custom_target(
'internal-api-docs',
command : [
- bash,
- # Meson can you please just give us a `workdir` argument to custom targets...
- '-c',
- # We have to prefix the doxygen_cfg path with the project build root
- # because of the cd in front.
- 'cd @0@ && @1@ @2@/@INPUT0@'.format(
- meson.project_source_root(),
- doxygen.full_path(),
- meson.project_build_root(),
- ),
+ doxygen.full_path(),
+ '@INPUT0@',
],
input : [
doxygen_cfg,