OLD | NEW |
---|---|
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 sys | 13 import sys |
14 | 14 |
15 # Do NOT CHANGE this if you don't know what you're doing -- see | 15 # Do NOT CHANGE this if you don't know what you're doing -- see |
16 # https://code.google.com/p/chromium/wiki/UpdatingClang | 16 # https://code.google.com/p/chromium/wiki/UpdatingClang |
17 # Reverting problematic clang rolls is safe, though. | 17 # Reverting problematic clang rolls is safe, though. |
18 # Note: this revision is only used for Windows. Other platforms use update.sh. | 18 # Note: this revision is only used for Windows. Other platforms use update.sh. |
19 LLVM_WIN_REVISION = 'HEAD' | 19 CLANG_REVISION = os.environ.get('LLVM_WIN_REVISION', '209387') |
Nico
2014/06/18 17:56:57
The bots should continue building HEAD, right? So
Reid Kleckner
2014/06/18 19:44:33
Yes. They have LLVM_WIN_REVISION=HEAD in the envi
Nico
2014/06/18 19:54:01
Yes, that's a long-term goal. It's strange to put
Reid Kleckner
2014/06/18 20:11:26
OK, I'll do that.
| |
20 | |
21 # Use a more quickly rolling Clang revision for ASan on Windows. | |
Nico
2014/06/18 17:56:57
I'd say something like
# ASan on Windows is usefu
Reid Kleckner
2014/06/18 19:44:33
I'll do this if we decide to go back to 'HEAD' as
| |
22 # TODO(timurrrr): Use the standard Clang revision above when ASan on Windows has | |
23 # stabilized. | |
24 if (sys.platform in ['win32', 'cygwin'] and | |
25 re.search(r'\b(asan)=1', os.environ.get('GYP_DEFINES', ''))): | |
26 CLANG_REVISION = '210586' | |
20 | 27 |
21 # Path constants. (All of these should be absolute paths.) | 28 # Path constants. (All of these should be absolute paths.) |
22 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 29 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
23 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) | 30 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) |
24 LLVM_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm') | 31 LLVM_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm') |
25 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', | 32 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', |
26 'Release+Asserts') | 33 'Release+Asserts') |
27 COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, '32bit-compiler-rt') | 34 COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, '32bit-compiler-rt') |
28 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') | 35 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') |
29 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt') | 36 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt') |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 print 'Failed.' | 88 print 'Failed.' |
82 sys.exit(1) | 89 sys.exit(1) |
83 | 90 |
84 def CopyFile(src, dst): | 91 def CopyFile(src, dst): |
85 """Copy a file from src to dst.""" | 92 """Copy a file from src to dst.""" |
86 shutil.copy(src, dst) | 93 shutil.copy(src, dst) |
87 print "Copying %s to %s" % (src, dst) | 94 print "Copying %s to %s" % (src, dst) |
88 | 95 |
89 def Checkout(name, url, dir): | 96 def Checkout(name, url, dir): |
90 """Checkout the SVN module at url into dir. Use name for the log message.""" | 97 """Checkout the SVN module at url into dir. Use name for the log message.""" |
91 print "Checking out %s r%s into '%s'" % (name, LLVM_WIN_REVISION, dir) | 98 print "Checking out %s r%s into '%s'" % (name, CLANG_REVISION, dir) |
92 RunCommand(['svn', 'checkout', '--force', | 99 RunCommand(['svn', 'checkout', '--force', |
93 url + '@' + LLVM_WIN_REVISION, dir], tries=2) | 100 url + '@' + CLANG_REVISION, dir], tries=2) |
94 | 101 |
95 | 102 |
96 vs_version = None | 103 vs_version = None |
97 def GetVSVersion(): | 104 def GetVSVersion(): |
98 global vs_version | 105 global vs_version |
99 if not vs_version: | 106 if not vs_version: |
100 # TODO(hans): Find a less hacky way to find the MSVS installation. | 107 # TODO(hans): Find a less hacky way to find the MSVS installation. |
101 sys.path.append(os.path.join(CHROMIUM_DIR, 'tools', 'gyp', 'pylib')) | 108 sys.path.append(os.path.join(CHROMIUM_DIR, 'tools', 'gyp', 'pylib')) |
102 import gyp.MSVSVersion | 109 import gyp.MSVSVersion |
103 # We request VS 2013 because Clang won't build with 2010, and 2013 will be | 110 # We request VS 2013 because Clang won't build with 2010, and 2013 will be |
104 # the default for Chromium soon anyway. | 111 # the default for Chromium soon anyway. |
105 vs_version = gyp.MSVSVersion.SelectVisualStudioVersion('2013') | 112 vs_version = gyp.MSVSVersion.SelectVisualStudioVersion('2013') |
106 return vs_version | 113 return vs_version |
107 | 114 |
108 | 115 |
109 def UpdateClang(): | 116 def UpdateClang(): |
110 print 'Updating Clang to %s...' % (LLVM_WIN_REVISION) | 117 print 'Updating Clang to %s...' % CLANG_REVISION |
111 if LLVM_WIN_REVISION != 'HEAD' and ReadStampFile() == LLVM_WIN_REVISION: | 118 if CLANG_REVISION != 'HEAD' and ReadStampFile() == CLANG_REVISION: |
112 print 'Already up to date.' | 119 print 'Already up to date.' |
113 return 0 | 120 return 0 |
114 | 121 |
115 ClobberChromiumBuildFiles() | 122 ClobberChromiumBuildFiles() |
116 | 123 |
117 # Reset the stamp file in case the build is unsuccessful. | 124 # Reset the stamp file in case the build is unsuccessful. |
118 WriteStampFile('') | 125 WriteStampFile('') |
119 | 126 |
120 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR) | 127 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR) |
121 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR) | 128 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 aux_sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', | 174 aux_sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', |
168 '3.5.0', 'include_sanitizer', | 175 '3.5.0', 'include_sanitizer', |
169 'sanitizer') | 176 'sanitizer') |
170 if not os.path.exists(aux_sanitizer_include_dir): | 177 if not os.path.exists(aux_sanitizer_include_dir): |
171 os.makedirs(aux_sanitizer_include_dir) | 178 os.makedirs(aux_sanitizer_include_dir) |
172 for _, _, files in os.walk(sanitizer_include_dir): | 179 for _, _, files in os.walk(sanitizer_include_dir): |
173 for f in files: | 180 for f in files: |
174 CopyFile(os.path.join(sanitizer_include_dir, f), | 181 CopyFile(os.path.join(sanitizer_include_dir, f), |
175 aux_sanitizer_include_dir) | 182 aux_sanitizer_include_dir) |
176 | 183 |
177 WriteStampFile(LLVM_WIN_REVISION) | 184 WriteStampFile(CLANG_REVISION) |
178 print 'Clang update was successful.' | 185 print 'Clang update was successful.' |
179 return 0 | 186 return 0 |
180 | 187 |
181 | 188 |
182 def main(): | 189 def main(): |
183 if not sys.platform in ['win32', 'cygwin']: | 190 if not sys.platform in ['win32', 'cygwin']: |
184 # For non-Windows, fall back to update.sh. | 191 # For non-Windows, fall back to update.sh. |
185 # TODO(hans): Make update.py replace update.sh completely. | 192 # TODO(hans): Make update.py replace update.sh completely. |
186 | 193 |
187 # This script is called by gclient. gclient opens its hooks subprocesses | 194 # This script is called by gclient. gclient opens its hooks subprocesses |
(...skipping 15 matching lines...) Expand all Loading... | |
203 | 210 |
204 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): | 211 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): |
205 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' | 212 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' |
206 return 0 | 213 return 0 |
207 | 214 |
208 return UpdateClang() | 215 return UpdateClang() |
209 | 216 |
210 | 217 |
211 if __name__ == '__main__': | 218 if __name__ == '__main__': |
212 sys.exit(main()) | 219 sys.exit(main()) |
OLD | NEW |