From 2a64d4c8b02138015335b3bff7e360bc9b4f1519 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 13 Apr 2021 00:18:13 +0200 Subject: reformat_cpp.sh: run inside Docker image if clang-format is not at version 10 --- scripts/reformat_cpp.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'scripts/reformat_cpp.sh') diff --git a/scripts/reformat_cpp.sh b/scripts/reformat_cpp.sh index 89237b65..4c2dab19 100755 --- a/scripts/reformat_cpp.sh +++ b/scripts/reformat_cpp.sh @@ -15,6 +15,14 @@ esac TOPDIR="$SCRIPT_DIR/.." +if ! (clang-format --version 2>/dev/null | grep 10 >/dev/null); then + echo "clang-format 10 not available. Running it from a Docker image"; + docker build -t proj_clang_format -f "$TOPDIR"/scripts/proj_clang_format/Dockerfile "$TOPDIR"/scripts/proj_clang_format + UID=$(id -u "${USER}") + GID=$(id -g "${USER}") + exec docker run --rm -u "$UID:$GID" -v "$TOPDIR":"$TOPDIR" proj_clang_format "$TOPDIR"/scripts/reformat_cpp.sh +fi + for i in "$TOPDIR"/include/proj/*.hpp "$TOPDIR"/include/proj/internal/*.hpp \ "$TOPDIR"/src/iso19111/*.cpp \ "$TOPDIR"/src/iso19111/operation/*.cpp \ -- cgit v1.2.3