798bc4ee1e
There are some large files, and in most setups (including CI runners) we have multiple cores available. Use xargs to run multiple parallel uncrustify jobs rather than one large one. Just hardcode 4 jobs and 4 files at the same time for now.
22 lines
437 B
Bash
Executable file
22 lines
437 B
Bash
Executable file
#!/bin/bash
|
|
SRCROOT=`git rev-parse --show-toplevel`
|
|
CFG="$SRCROOT/scripts/uncrustify.cfg"
|
|
echo "srcroot: $SRCROOT"
|
|
|
|
case "$1" in
|
|
-c|--check)
|
|
OPTS="--check"
|
|
;;
|
|
*)
|
|
OPTS="--replace --no-backup"
|
|
;;
|
|
esac
|
|
|
|
ARGS=4
|
|
JOBS=4
|
|
|
|
pushd "$SRCROOT"
|
|
git ls-tree --name-only -r HEAD | grep -E '.*\.[ch]$' | grep -v nbis | grep -v fpi-byte | grep -v build/ | xargs -n$ARGS -P $JOBS uncrustify -c "$CFG" $OPTS
|
|
RES=$?
|
|
popd
|
|
exit $RES
|