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

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

Issue 2224783002: clang update script: Verify that VERSION is correct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: regex Created 4 years, 4 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
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 """This script is used to download prebuilt clang binaries. 6 """This script is used to download prebuilt clang binaries.
7 7
8 It is also used by package.py to build the prebuilt clang binaries.""" 8 It is also used by package.py to build the prebuilt clang binaries."""
9 9
10 import argparse 10 import argparse
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 return vs_version 366 return vs_version
367 367
368 368
369 def CopyDiaDllTo(target_dir): 369 def CopyDiaDllTo(target_dir):
370 # This script always wants to use the 64-bit msdia*.dll. 370 # This script always wants to use the 64-bit msdia*.dll.
371 dia_path = os.path.join(GetVSVersion().Path(), 'DIA SDK', 'bin', 'amd64') 371 dia_path = os.path.join(GetVSVersion().Path(), 'DIA SDK', 'bin', 'amd64')
372 dia_dll = os.path.join(dia_path, DIA_DLL[GetVSVersion().ShortName()]) 372 dia_dll = os.path.join(dia_path, DIA_DLL[GetVSVersion().ShortName()])
373 CopyFile(dia_dll, target_dir) 373 CopyFile(dia_dll, target_dir)
374 374
375 375
376 def VeryifyVersionOfBuiltClangMatchesVERSION():
377 """Checks that `clang --version` outputs VERSION. If this fails, VERSION
378 in this file is out-of-date and needs to be updated (possibly in an
379 `if use_head_revision:` block in main() first)."""
380 clang = os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')
381 if sys.platform == 'win32':
382 # TODO: Parse `clang-cl /?` output for built clang's version and check that
383 # to check the binary we're actually shipping? But clang-cl.exe is just
384 # a copy of clang.exe, so this does check the same thing.
385 clang += '.exe'
386 version_out = subprocess.check_output([clang, '--version'])
387 version_out = re.match(r'clang version ([0-9.]+)', version_out).group(1)
388 if version_out != VERSION:
389 print ('unexpected clang version %s (not %s), update VERSION in update.py'
390 % (version_out, VERSION))
391 sys.exit(1)
392
393
376 def UpdateClang(args): 394 def UpdateClang(args):
377 print 'Updating Clang to %s...' % PACKAGE_VERSION 395 print 'Updating Clang to %s...' % PACKAGE_VERSION
378 396
379 need_gold_plugin = 'LLVM_DOWNLOAD_GOLD_PLUGIN' in os.environ or ( 397 need_gold_plugin = 'LLVM_DOWNLOAD_GOLD_PLUGIN' in os.environ or (
380 sys.platform.startswith('linux') and 398 sys.platform.startswith('linux') and
381 'buildtype=Official' in os.environ.get('GYP_DEFINES', '') and 399 'buildtype=Official' in os.environ.get('GYP_DEFINES', '') and
382 'branding=Chrome' in os.environ.get('GYP_DEFINES', '')) 400 'branding=Chrome' in os.environ.get('GYP_DEFINES', ''))
383 401
384 if ReadStampFile() == PACKAGE_VERSION and not args.force_local_build: 402 if ReadStampFile() == PACKAGE_VERSION and not args.force_local_build:
385 print 'Clang is already up to date.' 403 print 'Clang is already up to date.'
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 if args.tools: 659 if args.tools:
642 # If any Chromium tools were built, install those now. 660 # If any Chromium tools were built, install those now.
643 RunCommand(['ninja', 'cr-install'], msvc_arch='x64') 661 RunCommand(['ninja', 'cr-install'], msvc_arch='x64')
644 662
645 if sys.platform == 'darwin': 663 if sys.platform == 'darwin':
646 # See http://crbug.com/256342 664 # See http://crbug.com/256342
647 RunCommand(['strip', '-x', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')]) 665 RunCommand(['strip', '-x', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')])
648 elif sys.platform.startswith('linux'): 666 elif sys.platform.startswith('linux'):
649 RunCommand(['strip', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')]) 667 RunCommand(['strip', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')])
650 668
651 # TODO(thakis): Check that `clang --version` matches VERSION. 669 VeryifyVersionOfBuiltClangMatchesVERSION()
652 670
653 # Do an out-of-tree build of compiler-rt. 671 # Do an out-of-tree build of compiler-rt.
654 # On Windows, this is used to get the 32-bit ASan run-time. 672 # On Windows, this is used to get the 32-bit ASan run-time.
655 # TODO(hans): Remove once the regular build above produces this. 673 # TODO(hans): Remove once the regular build above produces this.
656 # On Mac and Linux, this is used to get the regular 64-bit run-time. 674 # On Mac and Linux, this is used to get the regular 64-bit run-time.
657 # Do a clobbered build due to cmake changes. 675 # Do a clobbered build due to cmake changes.
658 if os.path.isdir(COMPILER_RT_BUILD_DIR): 676 if os.path.isdir(COMPILER_RT_BUILD_DIR):
659 RmTree(COMPILER_RT_BUILD_DIR) 677 RmTree(COMPILER_RT_BUILD_DIR)
660 os.makedirs(COMPILER_RT_BUILD_DIR) 678 os.makedirs(COMPILER_RT_BUILD_DIR)
661 os.chdir(COMPILER_RT_BUILD_DIR) 679 os.chdir(COMPILER_RT_BUILD_DIR)
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 args.force_local_build = True 898 args.force_local_build = True
881 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): 899 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''):
882 # Only build the Android ASan rt on ToT bots when targetting Android. 900 # Only build the Android ASan rt on ToT bots when targetting Android.
883 args.with_android = False 901 args.with_android = False
884 902
885 return UpdateClang(args) 903 return UpdateClang(args)
886 904
887 905
888 if __name__ == '__main__': 906 if __name__ == '__main__':
889 sys.exit(main()) 907 sys.exit(main())
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