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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2
3 if [[ $# -eq 0 ]]; then
4 echo >&2 "Usage: `basename $0` <clang_rev>"
5 exit 1
6 fi
7
8 set -e
9 set -x
10
11 clang_rev="$1"
12 echo "$clang_rev" | grep -q '^\d\d\d\d\d\d'
13
14 which -s cmake
15 which -s ninja
16 which -s svn
17
18 cmake --version | grep -q 'cmake version 3.\d.\d'
19
20 compiler_dir=$(/bin/ls -d $HOME/chrom*/src/third_party/llvm-build/Release+Assert s/bin)
21
22 tmp=$(mktemp -d)
23
24 clean_up() {
25 set -x
26 rm -rf "$tmp"
27 }
28
29 trap "clean_up" SIGHUP SIGINT SIGTRAP
30
31 mkdir "$tmp/llvm" "$tmp/llvm-build"
32
33 llvm_project="http://llvm.org/svn/llvm-project"
34 svn co -q "$llvm_project/llvm/trunk@$clang_rev" "$tmp/llvm"
35 svn co -q "$llvm_project/cfe/trunk@$clang_rev" "$tmp/llvm/tools/clang"
36
37 llvm_build="$tmp/llvm-build"
38 pushd "$llvm_build" >/dev/null
39 MACOSX_DEPLOYMENT_TARGET=10.9 cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \
40 -DLLVM_ENABLE_ASSERTIONS=NO -DLLVM_ENABLE_THREADS=NO \
41 -DCMAKE_C_COMPILER="$compiler_dir/clang" \
42 -DCMAKE_CXX_COMPILER="$compiler_dir/clang++" \
43 "$tmp/llvm/" >/dev/null
44 popd >/dev/null
45
46 ninja -C "$llvm_build" clang-format >/dev/null
47 binary="$llvm_build/bin/clang-format"
48 strip "$binary"
49
50 if [[ `uname` == "Darwin" ]]; then
51 otool -l buildtools/mac/clang-format | grep -A2 'MIN_MACOSX' | tail -1 | grep -q 'version 10.9'
52 fi
53
54 set +e
55 set +x
56
57 which -s upload_to_google_storage.py
58 if [[ $? -ne 0 ]]; then
59 echo "Couldn't find upload_to_google_storage.py, ignoring upload"
60 else
61 read -p "Upload to google storage? [y/n] " -n 1 -r
62 echo
63 if [[ $REPLY =~ ^[Yy]$ ]]; then
64 set -e
65 set -x
66 upload_to_google_storage.py -b chromium-clang-format "$binary" >/dev/null
67 echo -n "SHA1: " && cat "$binary.sha1"
68 fi
69 fi
70
71 set +x
72 read -p "Delete $tmp? [y/n] " -n 1 -r
73 echo
74 if [[ $REPLY =~ ^[Yy]$ ]]; then
75 clean_up
76 fi
OLDNEW
« 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