Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: tools/roll_clang_format

Issue 2941973002: Add a roll_clang_format script that basically runs these steps:
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/roll_clang_format
diff --git a/tools/roll_clang_format b/tools/roll_clang_format
new file mode 100755
index 0000000000000000000000000000000000000000..09673ccb78b6a2dfdc09c4ca3f102fc3401fdf85
--- /dev/null
+++ b/tools/roll_clang_format
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+if [[ $# -eq 0 ]]; then
+ echo >&2 "Usage: `basename $0` <clang_rev>"
+ exit 1
+fi
+
+set -e
+set -x
+
+clang_rev="$1"
+echo "$clang_rev" | grep -q '^\d\d\d\d\d\d'
+
+which -s cmake
+which -s ninja
+which -s svn
+
+cmake --version | grep -q 'cmake version 3.\d.\d'
+
+compiler_dir=$(/bin/ls -d $HOME/chrom*/src/third_party/llvm-build/Release+Asserts/bin)
+
+tmp=$(mktemp -d)
+
+clean_up() {
+ set -x
+ rm -rf "$tmp"
+}
+
+trap "clean_up" SIGHUP SIGINT SIGTRAP
+
+mkdir "$tmp/llvm" "$tmp/llvm-build"
+
+llvm_project="http://llvm.org/svn/llvm-project"
+svn co -q "$llvm_project/llvm/trunk@$clang_rev" "$tmp/llvm"
+svn co -q "$llvm_project/cfe/trunk@$clang_rev" "$tmp/llvm/tools/clang"
+
+llvm_build="$tmp/llvm-build"
+pushd "$llvm_build" >/dev/null
+MACOSX_DEPLOYMENT_TARGET=10.9 cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
+ -DLLVM_ENABLE_ASSERTIONS=NO -DLLVM_ENABLE_THREADS=NO \
+ -DCMAKE_C_COMPILER="$compiler_dir/clang" \
+ -DCMAKE_CXX_COMPILER="$compiler_dir/clang++" \
+ "$tmp/llvm/" >/dev/null
+popd >/dev/null
+
+ninja -C "$llvm_build" clang-format >/dev/null
+binary="$llvm_build/bin/clang-format"
+strip "$binary"
+
+if [[ `uname` == "Darwin" ]]; then
+ otool -l buildtools/mac/clang-format | grep -A2 'MIN_MACOSX' | tail -1 | grep -q 'version 10.9'
+fi
+
+set +e
+set +x
+
+which -s upload_to_google_storage.py
+if [[ $? -ne 0 ]]; then
+ echo "Couldn't find upload_to_google_storage.py, ignoring upload"
+else
+ read -p "Upload to google storage? [y/n] " -n 1 -r
+ echo
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
+ set -e
+ set -x
+ upload_to_google_storage.py -b chromium-clang-format "$binary" >/dev/null
+ echo -n "SHA1: " && cat "$binary.sha1"
+ fi
+fi
+
+set +x
+read -p "Delete $tmp? [y/n] " -n 1 -r
+echo
+if [[ $REPLY =~ ^[Yy]$ ]]; then
+ clean_up
+fi
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698