scripts: auto-generate list of schemas
Since the list of schemas is growing and we already have a directory, it
does not need to be updated manually. Make a script for it and check
that that's been done in CI.
Tested: Using 'meson install', check that schemas are installed like
before.
Script works and updates the files as expected.
Change-Id: Ia1b3d99890477c4077e8e3a52a5338805d810440
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/scripts/generate_meson_array.sh b/scripts/generate_meson_array.sh
new file mode 100755
index 0000000..39d3127
--- /dev/null
+++ b/scripts/generate_meson_array.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -eu
+LANG=C
+
+if [ "$#" -ne 3 ]; then
+ echo "Usage: $0 <directory> <meson_array_name> <script_name>" >&2
+ exit 1
+fi
+
+dir="$1"
+array_name="$2"
+script_name="$3"
+meson_file="${dir}/meson.build"
+
+json_files=$(cd "$dir"; find . -regex "[\./]?[\/a-zA-Z0-9_\-]+.json" | sort | sed 's|^\./||')
+
+{
+ echo "# This file is auto-generated. Do not edit manually."
+ echo "# File content generated with ${script_name}"
+ echo "${array_name} = ["
+ for file in $json_files; do
+ echo " '${file}',"
+ done
+ echo "]"
+} > "$meson_file"
+