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:
parent
ad3156551c
commit
1591a16003
33
tools/format
33
tools/format
|
@ -23,19 +23,32 @@ if ! command -v clang_format.py &> /dev/null; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FILES=""
|
if ! command -v gn &> /dev/null; then
|
||||||
FILES+="`find src -name "*.h"` "
|
echo "gn not found on PATH"
|
||||||
FILES+="`find src -name "*.cc"` "
|
exit 1
|
||||||
FILES+="`find src -name "*.cpp"` "
|
fi
|
||||||
FILES+="`find src -name "*.m"` "
|
|
||||||
FILES+="`find src -name "*.mm"` "
|
CLANG_FORMAT_FILES=""
|
||||||
FILES+="`find include -name "*.h"` "
|
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
|
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 \
|
${SCRIPT_DIR}/run run-parallel \
|
||||||
clang_format.py -i \
|
clang_format.py -i \
|
||||||
$ -- $FILES
|
$ -- $CLANG_FORMAT_FILES
|
||||||
|
|
||||||
|
${SCRIPT_DIR}/run run-parallel \
|
||||||
|
gn format \
|
||||||
|
$ -- $GN_FILES
|
||||||
else
|
else
|
||||||
clang_format.py -i $FILES
|
clang_format.py -i $CLANG_FORMAT_FILES
|
||||||
|
gn format $GN_FILES
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue