aboutsummaryrefslogtreecommitdiff
path: root/util/ci
diff options
context:
space:
mode:
Diffstat (limited to 'util/ci')
-rwxr-xr-xutil/ci/clang-format.sh (renamed from util/ci/lint.sh)25
-rw-r--r--util/ci/common.sh10
-rw-r--r--util/ci/lint_autocorrect.sh45
3 files changed, 32 insertions, 48 deletions
diff --git a/util/ci/lint.sh b/util/ci/clang-format.sh
index 395445ca7..89576c656 100755
--- a/util/ci/lint.sh
+++ b/util/ci/clang-format.sh
@@ -1,6 +1,6 @@
#! /bin/bash
-function perform_lint() {
- echo "Performing LINT..."
+
+function setup_for_format() {
if [ -z "${CLANG_FORMAT}" ]; then
CLANG_FORMAT=clang-format
fi
@@ -8,6 +8,12 @@ function perform_lint() {
CLANG_FORMAT_WHITELIST="util/ci/clang-format-whitelist.txt"
files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')"
+}
+
+function check_format() {
+ echo "Checking format..."
+
+ setup_for_format
local errorcount=0
local fail=0
@@ -41,3 +47,18 @@ function perform_lint() {
echo "LINT OK"
}
+
+
+function fix_format() {
+ echo "Fixing format..."
+
+ setup_for_format
+
+ for f in ${files_to_lint}; do
+ whitelisted=$(awk '$1 == "'$f'" { print 1 }' "$CLANG_FORMAT_WHITELIST")
+ if [ -z "${whitelisted}" ]; then
+ echo "$f"
+ $CLANG_FORMAT -i "$f"
+ fi
+ done
+}
diff --git a/util/ci/common.sh b/util/ci/common.sh
index 7523fa7ff..d73c31b2f 100644
--- a/util/ci/common.sh
+++ b/util/ci/common.sh
@@ -2,12 +2,20 @@
# Linux build only
install_linux_deps() {
- local pkgs=(libirrlicht-dev cmake libbz2-dev libpng-dev \
+ local pkgs=(cmake libpng-dev \
libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev \
libhiredis-dev libogg-dev libgmp-dev libvorbis-dev libopenal-dev \
gettext libpq-dev postgresql-server-dev-all libleveldb-dev \
libcurl4-openssl-dev)
+ if [[ "$1" == "--old-irr" ]]; then
+ shift
+ pkgs+=(libirrlicht-dev)
+ else
+ wget "https://github.com/minetest/irrlicht/releases/download/1.9.0mt0/ubuntu-bionic.tar.gz"
+ sudo tar -xaf ubuntu-bionic.tar.gz -C /usr/local
+ fi
+
sudo apt-get update
sudo apt-get install -y --no-install-recommends ${pkgs[@]} "$@"
}
diff --git a/util/ci/lint_autocorrect.sh b/util/ci/lint_autocorrect.sh
deleted file mode 100644
index 6a8881231..000000000
--- a/util/ci/lint_autocorrect.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#! /bin/bash
-function perform_lint() {
- echo "Performing LINT..."
- if [ -z "${CLANG_FORMAT}" ]; then
- CLANG_FORMAT=clang-format
- fi
- echo "LINT: Using binary $CLANG_FORMAT"
- CLANG_FORMAT_WHITELIST="util/ci/clang-format-whitelist.txt"
-
- files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')"
-
- local errorcount=0
- local fail=0
- for f in ${files_to_lint}; do
- d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true)
-
- if ! [ -z "$d" ]; then
- whitelisted=$(awk '$1 == "'$f'" { print 1 }' "$CLANG_FORMAT_WHITELIST")
-
- # If file is not whitelisted, mark a failure
- if [ -z "${whitelisted}" ]; then
- errorcount=$((errorcount+1))
-
- printf "The file %s is not compliant with the coding style" "$f"
- if [ ${errorcount} -gt 50 ]; then
- printf "\nToo many errors encountered previously, this diff is hidden.\n"
- else
- printf ":\n%s\n" "$d"
- fi
-
- ${CLANG_FORMAT} -i "$f"
-
- fail=1
- fi
- fi
- done
-
- if [ "$fail" = 1 ]; then
- echo "LINT reports failure."
- exit 1
- fi
-
- echo "LINT OK"
-}
-