diff --git a/.gitignore b/.gitignore index 7d4a40dd0674037525b0f626ae2d95022bb65a83..ad6780d5e1a6aeca4d4208d1c85a3a23a06c552e 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,6 @@ t blk.bin *.dSYM scripts/toolpaths.local -clang-format compile_commands.json .vscode *_BACKUP_* diff --git a/scripts/clang-fmt b/scripts/clang-fmt index c39bf70db58e9936c4f3b2142848366ab6a06d90..a8804fb380fb4e171b557401e2b681753f430119 100755 --- a/scripts/clang-fmt +++ b/scripts/clang-fmt @@ -6,17 +6,8 @@ # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT -SCRIPTSDIR=`dirname $0` -CLANGFMT=$SCRIPTSDIR/clang-format +ZIRCON_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +CLANG_DIR="${ZIRCON_ROOT}/prebuilt/downloads/clang/bin" +CLANG_FMT="${CLANG_DIR}/clang-format" -if [ ! -f "$CLANGFMT" ]; then - echo "local clang-format not found. Running scripts/fetch-clang-fmt to get it." - ( cd $SCRIPTSDIR && ./fetch-clang-fmt ) -fi - -if [ ! -f $CLANGFMT ]; then - echo "$CLANGFMT still not found. Exiting." - exit 0 -fi - -$CLANGFMT -i -style=file $@ +exec "$CLANG_FMT" -i -style=file "$@" diff --git a/scripts/fetch-clang-fmt b/scripts/fetch-clang-fmt deleted file mode 100755 index 4836eef0e0dc0f2e29cce3bc308f72c441ec4651..0000000000000000000000000000000000000000 --- a/scripts/fetch-clang-fmt +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -# Copyright 2016 The Fuchsia Authors -# -# Use of this source code is governed by a MIT-style -# license that can be found in the LICENSE file or at -# https://opensource.org/licenses/MIT - -HASH= - -# hashes saved from -# -# https://chromium.googlesource.com/chromium/buildtools/+/master/linux64/clang-format.sha1 -# https://chromium.googlesource.com/chromium/buildtools/+/master/mac/clang-format.sha1 - -case `uname` in -Linux) - HASH=8b68e8093516183b8f38626740eeaff97f112f7e - ;; -Darwin) - HASH=afe0942b94fe33619361efe1510ae081c3070dc1 - ;; -*) - echo "OS not understood" - exit 1 -esac - -if [ -f clang-format ]; then - echo "clang-format already exists in local directory" - exit 1 -fi - -# fetch clang-format into the local directory -curl https://storage.googleapis.com/chromium-clang-format/$HASH > clang-format.fetch && -chmod +x clang-format.fetch && -mv clang-format.fetch clang-format