mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-13 10:51:35 +00:00
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>
55 lines
1.7 KiB
Bash
Executable File
55 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Copyright 2020 The Tint Authors.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
|
|
ROOT_DIR="$( cd "${SCRIPT_DIR}/.." >/dev/null 2>&1 && pwd )"
|
|
|
|
set -e # fail on error
|
|
|
|
if ! command -v clang_format.py &> /dev/null; then
|
|
echo "clang_format.py not found on PATH"
|
|
exit 1
|
|
fi
|
|
|
|
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 in parallel for speed wins
|
|
${SCRIPT_DIR}/run run-parallel \
|
|
clang_format.py -i \
|
|
$ -- $CLANG_FORMAT_FILES
|
|
|
|
${SCRIPT_DIR}/run run-parallel \
|
|
gn format \
|
|
$ -- $GN_FILES
|
|
else
|
|
clang_format.py -i $CLANG_FORMAT_FILES
|
|
gn format $GN_FILES
|
|
fi
|