Debian Codegraph @

.gitlab-ci/check-meson

raw symbols SCIP
1 #!/bin/bash
2 #
3 # Copyright (C) 2025 The Phosh developers
4 #
5 # SPDX-License-Identifier: GPL-3.0-or-later
6 #
7 # Author: Guido Günther <[email protected]>
8
9 ret=0
10
11 TMPDIR=$(mktemp -d)
12
13 # We check files individually so we can print the diff:
14 while IFS= read -r -d '' file; do
15 if ! meson format -e --check-only "$file"; then
16 echo
17 echo "Meson file '${file}' needs reformat:"
18 meson format -e "$file" > "${TMPDIR}/meson.build"
19 diff -u "$file" "${TMPDIR}/meson.build"
20 rm -f "${TMPDIR}/meson.build"
21 ret=1
22 fi
23 done < <(find . -name '*.build' -not -path './subprojects/*' -print0)
24
25 if [ -n "$TMPDIR" ]; then
26 rmdir "${TMPDIR}"
27 fi
28
29 if [ $ret -ne 0 ]; then
30 cat <<EOF
31
32 To reformat all files run:
33
34 meson format -e --recursive --inplace
35
36 EOF
37 fi
38
39 exit $ret