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

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

Issue 1239653004: Update Clang build script and gyp file for 3.8.0 version bump (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: try fixing base.isolate Created 5 years, 5 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
« base/base.isolate ('K') | « build/win/asan.gyp ('k') | 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 """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 argparse 9 import argparse
10 import contextlib 10 import contextlib
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 690
691 parser = argparse.ArgumentParser(description='Build Clang.') 691 parser = argparse.ArgumentParser(description='Build Clang.')
692 parser.add_argument('--bootstrap', action='store_true', 692 parser.add_argument('--bootstrap', action='store_true',
693 help='first build clang with CC, then with itself.') 693 help='first build clang with CC, then with itself.')
694 parser.add_argument('--if-needed', action='store_true', 694 parser.add_argument('--if-needed', action='store_true',
695 help="run only if the script thinks clang is needed") 695 help="run only if the script thinks clang is needed")
696 parser.add_argument('--force-local-build', action='store_true', 696 parser.add_argument('--force-local-build', action='store_true',
697 help="don't try to download prebuild binaries") 697 help="don't try to download prebuild binaries")
698 parser.add_argument('--print-revision', action='store_true', 698 parser.add_argument('--print-revision', action='store_true',
699 help='print current clang revision and exit.') 699 help='print current clang revision and exit.')
700 parser.add_argument('--print-clang-version', action='store_true',
701 help='print current clang version (e.g. x.y.z) and exit.')
700 parser.add_argument('--run-tests', action='store_true', 702 parser.add_argument('--run-tests', action='store_true',
701 help='run tests after building; only for local builds') 703 help='run tests after building; only for local builds')
702 parser.add_argument('--tools', nargs='*', 704 parser.add_argument('--tools', nargs='*',
703 help='select which chrome tools to build', 705 help='select which chrome tools to build',
704 default=['plugins', 'blink_gc_plugin']) 706 default=['plugins', 'blink_gc_plugin'])
705 parser.add_argument('--without-patches', action='store_false', 707 parser.add_argument('--without-patches', action='store_false',
706 help="don't apply patches (default)", dest='with_patches', 708 help="don't apply patches (default)", dest='with_patches',
707 default=True) 709 default=True)
708 710
709 # For now, these flags are only used for the non-Windows flow, but argparser 711 # For now, these flags are only used for the non-Windows flow, but argparser
(...skipping 11 matching lines...) Expand all
721 if re.search(r'\b(clang|asan|lsan|msan|tsan)=1', 723 if re.search(r'\b(clang|asan|lsan|msan|tsan)=1',
722 os.environ.get('GYP_DEFINES', '')): 724 os.environ.get('GYP_DEFINES', '')):
723 is_clang_required = True 725 is_clang_required = True
724 # clang previously downloaded, keep it up-to-date. 726 # clang previously downloaded, keep it up-to-date.
725 # If you don't want this, delete third_party/llvm-build on your machine. 727 # If you don't want this, delete third_party/llvm-build on your machine.
726 if os.path.isdir(LLVM_BUILD_DIR): 728 if os.path.isdir(LLVM_BUILD_DIR):
727 is_clang_required = True 729 is_clang_required = True
728 if not is_clang_required: 730 if not is_clang_required:
729 return 0 731 return 0
730 732
733 if use_head_revision:
734 # TODO(hans): Remove after the next roll.
735 global VERSION
736 VERSION = '3.8.0'
737
731 global LLVM_WIN_REVISION, PACKAGE_VERSION 738 global LLVM_WIN_REVISION, PACKAGE_VERSION
732 if args.print_revision: 739 if args.print_revision:
733 if use_head_revision: 740 if use_head_revision:
734 print GetSvnRevision(LLVM_DIR) 741 print GetSvnRevision(LLVM_DIR)
735 else: 742 else:
736 print PACKAGE_VERSION 743 print PACKAGE_VERSION
737 return 0 744 return 0
738 745
746 if args.print_clang_version:
747 sys.stdout.write(VERSION)
748 return 0
749
739 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): 750 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')):
740 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' 751 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).'
741 return 0 752 return 0
742 753
743 # Don't buffer stdout, so that print statements are immediately flushed. 754 # Don't buffer stdout, so that print statements are immediately flushed.
744 # Do this only after --print-revision has been handled, else we'll get 755 # Do this only after --print-revision has been handled, else we'll get
745 # an error message when this script is run from gn for some reason. 756 # an error message when this script is run from gn for some reason.
746 sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) 757 sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
747 758
748 if use_head_revision: 759 if use_head_revision:
749 # Use a real revision number rather than HEAD to make sure that the stamp 760 # Use a real revision number rather than HEAD to make sure that the stamp
750 # file logic works. 761 # file logic works.
751 LLVM_WIN_REVISION = GetSvnRevision(LLVM_REPO_URL) 762 LLVM_WIN_REVISION = GetSvnRevision(LLVM_REPO_URL)
752 PACKAGE_VERSION = LLVM_WIN_REVISION + '-0' 763 PACKAGE_VERSION = LLVM_WIN_REVISION + '-0'
753 764
754 args.force_local_build = True 765 args.force_local_build = True
755 # Skip local patches when using HEAD: they probably don't apply anymore. 766 # Skip local patches when using HEAD: they probably don't apply anymore.
756 args.with_patches = False 767 args.with_patches = False
757 768
758 return UpdateClang(args) 769 return UpdateClang(args)
759 770
760 771
761 if __name__ == '__main__': 772 if __name__ == '__main__':
762 sys.exit(main()) 773 sys.exit(main())
OLDNEW
« base/base.isolate ('K') | « build/win/asan.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698