mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 20:25:32 +03:00
lib/options: deprecate docbook text and literalDocBook
deprecate literalDocBook by adding a warning (that will not fire yet) to its uses and other docbook literal strings by adding optional warning message to mergeJSON.
This commit is contained in:
parent
8c309aa43a
commit
767485a0de
9 changed files with 118 additions and 45 deletions
|
@ -34,6 +34,10 @@
|
|||
# instead of printing warnings for eg options with missing descriptions (which may be lost
|
||||
# by nix build unless -L is given), emit errors instead and fail the build
|
||||
, warningsAreErrors ? true
|
||||
# allow docbook option docs if `true`. only markdown documentation is allowed when set to
|
||||
# `false`, and a different renderer may be used with different bugs and performance
|
||||
# characteristics but (hopefully) indistinguishable output.
|
||||
, allowDocBook ? true
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -127,26 +131,23 @@ in rec {
|
|||
];
|
||||
options = builtins.toFile "options.json"
|
||||
(builtins.unsafeDiscardStringContext (builtins.toJSON optionsNix));
|
||||
# merge with an empty set if baseOptionsJSON is null to run markdown
|
||||
# processing on the input options
|
||||
baseJSON =
|
||||
if baseOptionsJSON == null
|
||||
then builtins.toFile "base.json" "{}"
|
||||
else baseOptionsJSON;
|
||||
}
|
||||
''
|
||||
# Export list of options in different format.
|
||||
dst=$out/share/doc/nixos
|
||||
mkdir -p $dst
|
||||
|
||||
${
|
||||
if baseOptionsJSON == null
|
||||
then ''
|
||||
# `cp $options $dst/options.json`, but with temporary
|
||||
# markdown processing
|
||||
python ${./mergeJSON.py} $options <(echo '{}') > $dst/options.json
|
||||
''
|
||||
else ''
|
||||
python ${./mergeJSON.py} \
|
||||
${lib.optionalString warningsAreErrors "--warnings-are-errors"} \
|
||||
${baseOptionsJSON} $options \
|
||||
> $dst/options.json
|
||||
''
|
||||
}
|
||||
python ${./mergeJSON.py} \
|
||||
${lib.optionalString warningsAreErrors "--warnings-are-errors"} \
|
||||
${lib.optionalString (! allowDocBook) "--error-on-docbook"} \
|
||||
$baseJSON $options \
|
||||
> $dst/options.json
|
||||
|
||||
brotli -9 < $dst/options.json > $dst/options.json.br
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue