aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-04-13 12:22:18 +0200
committerGitHub <noreply@github.com>2021-04-13 12:22:18 +0200
commit58b991b8b98fdff6f6685e6bf5010f216b3ee1be (patch)
tree94c5571aa2b8b4a892b5b31aa8d10b0661683c19
parentff771264d7631356c2553e04b427ab3c7546d06d (diff)
parent2a64d4c8b02138015335b3bff7e360bc9b4f1519 (diff)
downloadPROJ-58b991b8b98fdff6f6685e6bf5010f216b3ee1be.tar.gz
PROJ-58b991b8b98fdff6f6685e6bf5010f216b3ee1be.zip
Merge pull request #2668 from rouault/reformat_cpp_docker
reformat_cpp.sh: run inside Docker image if clang-format is not at version 10
-rw-r--r--scripts/proj_clang_format/Dockerfile5
-rwxr-xr-xscripts/reformat_cpp.sh8
2 files changed, 13 insertions, 0 deletions
diff --git a/scripts/proj_clang_format/Dockerfile b/scripts/proj_clang_format/Dockerfile
new file mode 100644
index 00000000..c6bff10a
--- /dev/null
+++ b/scripts/proj_clang_format/Dockerfile
@@ -0,0 +1,5 @@
+# 3.12 for clang-format-10
+FROM alpine:3.12
+
+RUN apk add --no-cache clang
+
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 \