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

Side by Side Diff: tools/clang/scripts/update.py

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Windows can't run .sh files, so this is a Python implementation of 6 """Windows can't run .sh files, so this is a Python implementation of
7 update.sh. This script should replace update.sh on all platforms eventually.""" 7 update.sh. This script should replace update.sh on all platforms eventually."""
8 8
9 import os 9 import os
10 import re 10 import re
11 import shutil 11 import shutil
12 import subprocess 12 import subprocess
13 import stat 13 import stat
14 import sys 14 import sys
15 import time 15 import time
16 16
17 # Do NOT CHANGE this if you don't know what you're doing -- see 17 # Do NOT CHANGE this if you don't know what you're doing -- see
18 # https://code.google.com/p/chromium/wiki/UpdatingClang 18 # https://code.google.com/p/chromium/wiki/UpdatingClang
19 # Reverting problematic clang rolls is safe, though. 19 # Reverting problematic clang rolls is safe, though.
20 # Note: this revision is only used for Windows. Other platforms use update.sh. 20 # Note: this revision is only used for Windows. Other platforms use update.sh.
21 LLVM_WIN_REVISION = 'HEAD' 21 LLVM_WIN_REVISION = 'HEAD'
22 22
23 # ASan on Windows is useful enough to use it even while the clang/win is still 23 # ASan on Windows is useful enough to use it even while the clang/win is still
24 # in bringup. Use a pinned revision to make it slightly more stable. 24 # in bringup. Use a pinned revision to make it slightly more stable.
25 if (re.search(r'\b(asan)=1', os.environ.get('GYP_DEFINES', '')) and 25 if (re.search(r'\b(asan)=1', os.environ.get('GYP_DEFINES', '')) and
26 not 'LLVM_FORCE_HEAD_REVISION' in os.environ): 26 not 'LLVM_FORCE_HEAD_REVISION' in os.environ):
27 LLVM_WIN_REVISION = '225621' 27 LLVM_WIN_REVISION = '226270'
28 28
29 # Path constants. (All of these should be absolute paths.) 29 # Path constants. (All of these should be absolute paths.)
30 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) 30 THIS_DIR = os.path.abspath(os.path.dirname(__file__))
31 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) 31 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..'))
32 LLVM_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm') 32 LLVM_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm')
33 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', 33 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build',
34 'Release+Asserts') 34 'Release+Asserts')
35 COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, '32bit-compiler-rt') 35 COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, '32bit-compiler-rt')
36 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') 36 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang')
37 LLD_DIR = os.path.join(LLVM_DIR, 'tools', 'lld') 37 LLD_DIR = os.path.join(LLVM_DIR, 'tools', 'lld')
38 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt') 38 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt')
39 STAMP_FILE = os.path.join(LLVM_BUILD_DIR, 'cr_build_revision') 39 STAMP_FILE = os.path.join(LLVM_BUILD_DIR, 'cr_build_revision')
40 VERSION = '3.7.0'
40 41
41 LLVM_REPO_URL='https://llvm.org/svn/llvm-project' 42 LLVM_REPO_URL='https://llvm.org/svn/llvm-project'
42 if 'LLVM_REPO_URL' in os.environ: 43 if 'LLVM_REPO_URL' in os.environ:
43 LLVM_REPO_URL = os.environ['LLVM_REPO_URL'] 44 LLVM_REPO_URL = os.environ['LLVM_REPO_URL']
44 45
45 46
46 def ReadStampFile(): 47 def ReadStampFile():
47 """Return the contents of the stamp file, or '' if it doesn't exist.""" 48 """Return the contents of the stamp file, or '' if it doesn't exist."""
48 try: 49 try:
49 with open(STAMP_FILE, 'r') as f: 50 with open(STAMP_FILE, 'r') as f:
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 if not os.path.exists(COMPILER_RT_BUILD_DIR): 212 if not os.path.exists(COMPILER_RT_BUILD_DIR):
212 os.makedirs(COMPILER_RT_BUILD_DIR) 213 os.makedirs(COMPILER_RT_BUILD_DIR)
213 os.chdir(COMPILER_RT_BUILD_DIR) 214 os.chdir(COMPILER_RT_BUILD_DIR)
214 RunCommand(GetVSVersion().SetupScript('x86') + 215 RunCommand(GetVSVersion().SetupScript('x86') +
215 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', 216 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release',
216 '-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR]) 217 '-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR])
217 RunCommand(GetVSVersion().SetupScript('x86') + ['&&', 'ninja', 'compiler-rt']) 218 RunCommand(GetVSVersion().SetupScript('x86') + ['&&', 'ninja', 'compiler-rt'])
218 219
219 # TODO(hans): Make this (and the .gypi file) version number independent. 220 # TODO(hans): Make this (and the .gypi file) version number independent.
220 asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', 'clang', 221 asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', 'clang',
221 '3.6.0', 'lib', 'windows') 222 VERSION, 'lib', 'windows')
222 asan_rt_lib_dst_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', 223 asan_rt_lib_dst_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang',
223 '3.6.0', 'lib', 'windows') 224 VERSION, 'lib', 'windows')
224 CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir, 225 CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir,
225 r'^.*-i386\.lib$') 226 r'^.*-i386\.lib$')
226
227 # TODO(hans): Remove when LLVM_WIN_REVISION is updated.
228 # Old versions of compiler-rt will leave the asan dll in bin/
229 asan_rt_bin_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'bin')
230 CopyDirectoryContents(asan_rt_bin_src_dir, asan_rt_lib_dst_dir,
231 r'^.*-i386\.dll$')
232
233 CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir, 227 CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir,
234 r'^.*-i386\.dll$') 228 r'^.*-i386\.dll$')
235 229
236 CopyFile(os.path.join(asan_rt_lib_src_dir, '..', '..', 'asan_blacklist.txt'), 230 CopyFile(os.path.join(asan_rt_lib_src_dir, '..', '..', 'asan_blacklist.txt'),
237 os.path.join(asan_rt_lib_dst_dir, '..', '..')) 231 os.path.join(asan_rt_lib_dst_dir, '..', '..'))
238 232
239 # Make an extra copy of the sanitizer headers, to be put on the include path 233 # Make an extra copy of the sanitizer headers, to be put on the include path
240 # of the fallback compiler. 234 # of the fallback compiler.
241 sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', '3.6.0', 235 sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', VERSION,
242 'include', 'sanitizer') 236 'include', 'sanitizer')
243 aux_sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', 237 aux_sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang',
244 '3.6.0', 'include_sanitizer', 238 VERSION, 'include_sanitizer',
245 'sanitizer') 239 'sanitizer')
246 if not os.path.exists(aux_sanitizer_include_dir): 240 if not os.path.exists(aux_sanitizer_include_dir):
247 os.makedirs(aux_sanitizer_include_dir) 241 os.makedirs(aux_sanitizer_include_dir)
248 for _, _, files in os.walk(sanitizer_include_dir): 242 for _, _, files in os.walk(sanitizer_include_dir):
249 for f in files: 243 for f in files:
250 CopyFile(os.path.join(sanitizer_include_dir, f), 244 CopyFile(os.path.join(sanitizer_include_dir, f),
251 aux_sanitizer_include_dir) 245 aux_sanitizer_include_dir)
252 246
253 WriteStampFile(LLVM_WIN_REVISION) 247 WriteStampFile(LLVM_WIN_REVISION)
254 print 'Clang update was successful.' 248 print 'Clang update was successful.'
(...skipping 24 matching lines...) Expand all
279 273
280 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): 274 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')):
281 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' 275 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).'
282 return 0 276 return 0
283 277
284 return UpdateClang() 278 return UpdateClang()
285 279
286 280
287 if __name__ == '__main__': 281 if __name__ == '__main__':
288 sys.exit(main()) 282 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698