summaryrefslogtreecommitdiffstats
path: root/scripts/poe-tasks
diff options
context:
space:
mode:
authorAleš Mrázek <ales.mrazek@nic.cz>2024-09-16 17:53:12 +0200
committerAleš Mrázek <ales.mrazek@nic.cz>2024-09-30 11:16:07 +0200
commit5ad88a404edffd477d78f210f2d4328543e8a8ff (patch)
tree958fa37b03d0ea26ab75bacfc902321bf7c3a37f /scripts/poe-tasks
parentpython: use CACHE_DIR and RUN_DIR constants (diff)
downloadknot-resolver-5ad88a404edffd477d78f210f2d4328543e8a8ff.tar.xz
knot-resolver-5ad88a404edffd477d78f210f2d4328543e8a8ff.zip
scripts/poe-tasks: doc-schema added
The script that generates the configuration JSON schema with the correct values.
Diffstat (limited to 'scripts/poe-tasks')
-rwxr-xr-xscripts/poe-tasks/clean2
-rwxr-xr-xscripts/poe-tasks/doc-schema15
-rw-r--r--scripts/poe-tasks/utils/_env.sh1
3 files changed, 17 insertions, 1 deletions
diff --git a/scripts/poe-tasks/clean b/scripts/poe-tasks/clean
index f5d4ca1a..a50044f0 100755
--- a/scripts/poe-tasks/clean
+++ b/scripts/poe-tasks/clean
@@ -14,7 +14,7 @@ echo
echo ------------------------------------------
echo Removing Meson build directories and files
echo ------------------------------------------
-rm -vrf "$build_dir" "$KRES_INSTALL_DIR" "$build_doc_dir" build dist
+rm -vrf "$build_dir" "$KRES_INSTALL_DIR" "$build_schema_dir" "$build_doc_dir" build dist
echo
echo ------------------------------------------
diff --git a/scripts/poe-tasks/doc-schema b/scripts/poe-tasks/doc-schema
new file mode 100755
index 00000000..4cf5c186
--- /dev/null
+++ b/scripts/poe-tasks/doc-schema
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+# ensure consistent behaviour
+src_dir="$(dirname "$(realpath "$0")")"
+source $src_dir/utils/_env.sh
+
+rm -rf $build_schema_dir > /dev/null
+meson setup \
+ $build_schema_dir \
+ --buildtype=release \
+ --prefix=/usr > /dev/null
+cp -v $build_schema_dir/python/constants.py $gitroot/python/knot_resolver/constants.py
+
+python -m knot_resolver.client schema > $gitroot/doc/_static/config.schema.json
+rm -rf $build_schema_dir
diff --git a/scripts/poe-tasks/utils/_env.sh b/scripts/poe-tasks/utils/_env.sh
index b6cbb19e..13ed2d5d 100644
--- a/scripts/poe-tasks/utils/_env.sh
+++ b/scripts/poe-tasks/utils/_env.sh
@@ -20,6 +20,7 @@ cd $gitroot
# build dirs
build_dir="$gitroot/.build"
build_doc_dir="$gitroot/.build_doc"
+build_schema_dir="$gitroot/.build_schema"
install_dir="$gitroot/.install"
# ensure consistent environment with virtualenv