diff options
author | Qyriad <qyriad@qyriad.me> | 2024-04-05 21:11:40 -0600 |
---|---|---|
committer | Qyriad <qyriad@qyriad.me> | 2024-04-06 14:43:14 -0600 |
commit | 5bac308c7c141857c6ead02ca02b2e832d0e5921 (patch) | |
tree | b42f50e179fbc1b882f171e43386d86da1cb8ba0 /doc/manual/meson.build | |
parent | 1b5b9de04e8003362836b460a8a8d3cd784ddc41 (diff) |
meson: fix warm nix3 CLI manual generation
`nix eval --write-to` refuses to write to a directory that exists at
all, so now we generate in a temporary directory, and copy the generated
tree to the build directory. This is equivalent to what the Make
buildsystem did, actually, but hopefully more robust.
Future work: documenting the doc generation architecture in the
top-level meson.build outline comment.
Change-Id: Ic3eb6d26e3cc249a1c042fd3ced22d637ac66a69
Diffstat (limited to 'doc/manual/meson.build')
-rw-r--r-- | doc/manual/meson.build | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/doc/manual/meson.build b/doc/manual/meson.build index 02b707ff3..dafec9a4c 100644 --- a/doc/manual/meson.build +++ b/doc/manual/meson.build @@ -132,15 +132,26 @@ nix3_cli_json = custom_target( capture : true, output : 'nix.json', ) +# `nix eval --write-to` is rather picky, and refuses to write to a directory that exists at all. +# This is fine for clean builds because it creates the directory and then is never run again, +# but during development if nix.json changes, then using `nix eval --write-to` will error, +# since that part of the build directory already exists. +# Thus, another Python script. It runs the relevant `nix eval --write-to` command in a temporary +# directory, and then copies that tree to our build output directory. nix3_cli_files = custom_target( - command : nix_eval_for_docs + [ - '--write-to', '@OUTPUT@', - '--expr', - 'import @INPUT1@ true (builtins.readFile @INPUT0@)', + command : [ + python, + '@INPUT0@', + '--nix=@INPUT1@', + '--generator=@INPUT2@', + '--cli-json=@INPUT3@', + '--output=@OUTPUT@', ], input : [ - nix3_cli_json, - 'generate-manpage.nix', + 'generate-manpage.py', # INPUT0 + nix, # INPUT1 + 'generate-manpage.nix', # INPUT2 + nix3_cli_json, # INPUT3 'utils.nix', ], output : 'new-cli', |