Skip to content

Commit

Permalink
Merge pull request #2668 from rouault/reformat_cpp_docker
Browse files Browse the repository at this point in the history
reformat_cpp.sh: run inside Docker image if clang-format is not at version 10
  • Loading branch information
rouault authored Apr 13, 2021
2 parents ff77126 + 2a64d4c commit 58b991b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/proj_clang_format/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 3.12 for clang-format-10
FROM alpine:3.12

RUN apk add --no-cache clang

8 changes: 8 additions & 0 deletions scripts/reformat_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 58b991b

Please sign in to comment.