mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
tools: Parallelize ./tools/format
10x speed improvement on my 3990x machine Change-Id: Ie4b2377719e9a25860ec05bb7649aa652d26ccf0 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113022 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
d933470b20
commit
f2b8d2b1ab
32
tools/format
32
tools/format
@@ -13,9 +13,29 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
find src -name "*.h" -exec clang_format.py -i {} \;
|
||||
find src -name "*.cc" -exec clang_format.py -i {} \;
|
||||
find src -name "*.cpp" -exec clang_format.py -i {} \;
|
||||
find src -name "*.m" -exec clang_format.py -i {} \;
|
||||
find src -name "*.mm" -exec clang_format.py -i {} \;
|
||||
find include -name "*.h" -exec clang_format.py -i {} \;
|
||||
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
|
||||
|
||||
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 go &> /dev/null; then
|
||||
# Go is installed. Run cpplint in parallel for speed wins
|
||||
${SCRIPT_DIR}/run run-parallel \
|
||||
clang_format.py -i \
|
||||
$ -- $FILES
|
||||
else
|
||||
clang_format.py -i $FILES
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user