forked from swisspol/GCDWebServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
format-source.sh
executable file
·43 lines (36 loc) · 1.04 KB
/
format-source.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh -exuo pipefail
# brew install clang-format
CLANG_FORMAT_VERSION=`clang-format -version | awk '{ print $3 }'`
if [[ "$CLANG_FORMAT_VERSION" != "7.0.0" ]]; then
echo "Unsupported clang-format version"
exit 1
fi
if [[ ! -f "build/swiftformat" ]]; then
mkdir -p "build"
curl -sfL -o "build/SwiftFormat.zip" "https://github.com/nicklockwood/SwiftFormat/archive/0.37.2.zip"
unzip "build/SwiftFormat.zip" "SwiftFormat-0.37.2/CommandLineTool/swiftformat" -d "build"
mv "build/SwiftFormat-0.37.2/CommandLineTool/swiftformat" "build/swiftformat"
fi
pushd "GCDWebServer/Core"
clang-format -style=file -i *.h *.m
popd
pushd "GCDWebServer/Requests"
clang-format -style=file -i *.h *.m
popd
pushd "GCDWebServer/Responses"
clang-format -style=file -i *.h *.m
popd
pushd "GCDWebUploader"
clang-format -style=file -i *.h *.m
popd
pushd "GCDWebDAVServer"
clang-format -style=file -i *.h *.m
popd
pushd "Frameworks"
clang-format -style=file -i *.h *.m
popd
pushd "Mac"
clang-format -style=file -i *.m
popd
build/swiftformat --indent 2 "iOS" "tvOS"
echo "OK"