Skip to content
Snippets Groups Projects
Commit af46711b authored by Jake Ehrlich's avatar Jake Ehrlich Committed by CQ bot account: commit-bot@chromium.org
Browse files

[scripts] Replace old clang-format script

Test: ./scripts/clang-fmt <some file> and ./scripts/clang-fmt --version
Change-Id: Ic8c8a830e3914dc0eba9b05abf4d9a8d5dac2e12
parent e0aa0705
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,6 @@ t
blk.bin
*.dSYM
scripts/toolpaths.local
clang-format
compile_commands.json
.vscode
*_BACKUP_*
......
......@@ -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 "$@"
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment