tools/format: Format .gn files too

Change-Id: I2ff7e099e4b8a4a71e1900fdd3f904630cb87a4d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118501
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton 2023-02-05 12:38:23 +00:00 committed by Dawn LUCI CQ
parent ad3156551c
commit 1591a16003
1 changed files with 23 additions and 10 deletions

View File

@ -23,19 +23,32 @@ if ! command -v clang_format.py &> /dev/null; then
exit 1
fi
FILES=""
FILES+="`find src -name "*.h"` "
FILES+="`find src -name "*.cc"` "
FILES+="`find src -name "*.cpp"` "
FILES+="`find src -name "*.m"` "
FILES+="`find src -name "*.mm"` "
FILES+="`find include -name "*.h"` "
if ! command -v gn &> /dev/null; then
echo "gn not found on PATH"
exit 1
fi
CLANG_FORMAT_FILES=""
CLANG_FORMAT_FILES+="`find src -name "*.h"` "
CLANG_FORMAT_FILES+="`find src -name "*.cc"` "
CLANG_FORMAT_FILES+="`find src -name "*.cpp"` "
CLANG_FORMAT_FILES+="`find src -name "*.m"` "
CLANG_FORMAT_FILES+="`find src -name "*.mm"` "
CLANG_FORMAT_FILES+="`find include -name "*.h"` "
GN_FILES="BUILD.gn "
GN_FILES+="`find src -name "*.gn"` "
if command -v go &> /dev/null; then
# Go is installed. Run cpplint in parallel for speed wins
# Go is installed. Run in parallel for speed wins
${SCRIPT_DIR}/run run-parallel \
clang_format.py -i \
$ -- $FILES
$ -- $CLANG_FORMAT_FILES
${SCRIPT_DIR}/run run-parallel \
gn format \
$ -- $GN_FILES
else
clang_format.py -i $FILES
clang_format.py -i $CLANG_FORMAT_FILES
gn format $GN_FILES
fi