aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorOlivia Crain <olivia@olivia.dev>2024-10-04 09:59:01 +0000
committerGerrit Code Review <gerrit@localhost>2024-10-04 09:59:01 +0000
commit1bfc37fea5bc0439bdc0994c3c55cc094079a58e (patch)
tree3764d98a3ef1c1205c80a09917092b75d909ba4b /doc
parent8f300fbd82f16baa233d7232485f16cbbae851d5 (diff)
parent2f794733b2af153ff0f6b7ba3a963d84d63c0e03 (diff)
Merge "internal-api-docs: allow Doxygen to build regardless of workdir" into main
Diffstat (limited to 'doc')
-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,