[fractal/fractal-next] scripts: Add check for resources.gresource.xml
- From: Julian Sparber <jsparber src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/fractal-next] scripts: Add check for resources.gresource.xml
- Date: Wed, 19 Jan 2022 23:12:17 +0000 (UTC)
commit 4f55a4a4609da49ec0bdd4c9e7db1b05e58c6060
Author: Kévin Commaille <zecakeh tedomum fr>
Date: Wed Jan 19 21:57:09 2022 +0100
scripts: Add check for resources.gresource.xml
scripts/checks.sh | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
---
diff --git a/scripts/checks.sh b/scripts/checks.sh
index 9f904c6e..5dd7a68a 100755
--- a/scripts/checks.sh
+++ b/scripts/checks.sh
@@ -388,6 +388,41 @@ check_potfiles() {
fi
}
+# Check if files in data/resources/resources.gresource.xml are sorted alphabetically.
+check_resources() {
+ echo -e "$Checking data/resources/resources.gresource.xml…"
+
+ local ret=0
+
+ # Get files.
+ regex="<file .*>(.*)</file>"
+ while read -r line; do
+ if [[ $line =~ $regex ]]; then
+ files+=("${BASH_REMATCH[1]}")
+ fi
+ done < data/resources/resources.gresource.xml
+
+ # Check sorted alphabetically
+ to_sort=("${files[@]}")
+ sort
+ for i in ${!files[@]}; do
+ if [[ "${files[$i]}" != "${to_sort[$i]}" ]]; then
+ echo -e "$error Found file '${files[$i]#src/}' before '${to_sort[$i]#src/}' in
resources.gresource.xml"
+ ret=1
+ break
+ fi
+ done
+
+ if [[ ret -eq 1 ]]; then
+ echo ""
+ echo -e " Checking data/resources/resources.gresource.xml result: $fail"
+ echo "Please fix the above issues"
+ exit 1
+ else
+ echo -e " Checking data/resources/resources.gresource.xml result: $ok"
+ fi
+}
+
# Check arguments
while [[ "$1" ]]; do case $1 in
-f | --force-install )
@@ -412,4 +447,7 @@ run_rustfmt
echo ""
run_typos
echo ""
-check_potfiles
\ No newline at end of file
+check_potfiles
+echo ""
+check_resources
+echo ""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]