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 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 for root, _, files in os.walk(dir): | 65 for root, _, files in os.walk(dir): |
66 for f in files: | 66 for f in files: |
67 if regex.match(f): | 67 if regex.match(f): |
68 os.remove(os.path.join(root, f)) | 68 os.remove(os.path.join(root, f)) |
69 n += 1 | 69 n += 1 |
70 return n | 70 return n |
71 | 71 |
72 | 72 |
73 def ClobberChromiumBuildFiles(): | 73 def ClobberChromiumBuildFiles(): |
74 """Clobber Chomium build files.""" | 74 """Clobber Chomium build files.""" |
| 75 return |
75 print 'Clobbering Chromium build files...' | 76 print 'Clobbering Chromium build files...' |
76 out_dir = os.path.join(CHROMIUM_DIR, 'out') | 77 out_dir = os.path.join(CHROMIUM_DIR, 'out') |
77 if os.path.isdir(out_dir): | 78 if os.path.isdir(out_dir): |
78 shutil.rmtree(out_dir) | 79 shutil.rmtree(out_dir) |
79 print 'Removed Chromium out dir: %s.' % (out_dir) | 80 print 'Removed Chromium out dir: %s.' % (out_dir) |
80 | 81 |
81 | 82 |
82 def RunCommand(command, tries=1): | 83 def RunCommand(command, tries=1): |
83 """Run a command, possibly with multiple retries.""" | 84 """Run a command, possibly with multiple retries.""" |
84 for i in range(0, tries): | 85 for i in range(0, tries): |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 candidate = os.path.join(path, 'svn' + ext) | 164 candidate = os.path.join(path, 'svn' + ext) |
164 if os.path.isfile(candidate): | 165 if os.path.isfile(candidate): |
165 return '-DSubversion_SVN_EXECUTABLE=%s' % candidate | 166 return '-DSubversion_SVN_EXECUTABLE=%s' % candidate |
166 return '' | 167 return '' |
167 | 168 |
168 | 169 |
169 def UpdateClang(): | 170 def UpdateClang(): |
170 print 'Updating Clang to %s...' % (LLVM_WIN_REVISION) | 171 print 'Updating Clang to %s...' % (LLVM_WIN_REVISION) |
171 if LLVM_WIN_REVISION != 'HEAD' and ReadStampFile() == LLVM_WIN_REVISION: | 172 if LLVM_WIN_REVISION != 'HEAD' and ReadStampFile() == LLVM_WIN_REVISION: |
172 print 'Already up to date.' | 173 print 'Already up to date.' |
173 return 0 | 174 # return 0 |
174 | 175 |
175 AddCMakeToPath() | 176 AddCMakeToPath() |
176 ClobberChromiumBuildFiles() | 177 ClobberChromiumBuildFiles() |
177 | 178 |
178 # Reset the stamp file in case the build is unsuccessful. | 179 # Reset the stamp file in case the build is unsuccessful. |
179 WriteStampFile('') | 180 WriteStampFile('') |
180 | 181 |
181 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR) | 182 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR) |
182 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR) | 183 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR) |
183 Checkout('LLD', LLVM_REPO_URL + '/lld/trunk', LLD_DIR) | 184 Checkout('LLD', LLVM_REPO_URL + '/lld/trunk', LLD_DIR) |
184 Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR) | 185 Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR) |
185 | 186 |
186 if not os.path.exists(LLVM_BUILD_DIR): | 187 if not os.path.exists(LLVM_BUILD_DIR): |
187 os.makedirs(LLVM_BUILD_DIR) | 188 os.makedirs(LLVM_BUILD_DIR) |
188 os.chdir(LLVM_BUILD_DIR) | 189 os.chdir(LLVM_BUILD_DIR) |
189 | 190 |
190 RunCommand(GetVSVersion().SetupScript('x64') + | 191 RunCommand(GetVSVersion().SetupScript('x64') + |
191 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', | 192 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', |
| 193 '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'c
lang'), |
| 194 '-DCHROMIUM_TOOLS=rewrite_scoped_refptr', |
192 '-DLLVM_ENABLE_ASSERTIONS=ON', SubversionCmakeArg(), LLVM_DIR]) | 195 '-DLLVM_ENABLE_ASSERTIONS=ON', SubversionCmakeArg(), LLVM_DIR]) |
193 RunCommand(GetVSVersion().SetupScript('x64') + ['&&', 'ninja', 'all']) | 196 RunCommand(GetVSVersion().SetupScript('x64') + ['&&', 'ninja', 'all']) |
194 | 197 |
| 198 WriteStampFile(LLVM_WIN_REVISION) |
| 199 print 'Clang update was successful.' |
| 200 return 0 |
| 201 |
195 # Do an x86 build of compiler-rt to get the 32-bit ASan run-time. | 202 # Do an x86 build of compiler-rt to get the 32-bit ASan run-time. |
196 # TODO(hans): Remove once the regular build above produces this. | 203 # TODO(hans): Remove once the regular build above produces this. |
197 if not os.path.exists(COMPILER_RT_BUILD_DIR): | 204 if not os.path.exists(COMPILER_RT_BUILD_DIR): |
198 os.makedirs(COMPILER_RT_BUILD_DIR) | 205 os.makedirs(COMPILER_RT_BUILD_DIR) |
199 os.chdir(COMPILER_RT_BUILD_DIR) | 206 os.chdir(COMPILER_RT_BUILD_DIR) |
200 RunCommand(GetVSVersion().SetupScript('x86') + | 207 RunCommand(GetVSVersion().SetupScript('x86') + |
201 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', | 208 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', |
202 '-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR]) | 209 '-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR]) |
203 RunCommand(GetVSVersion().SetupScript('x86') + ['&&', 'ninja', 'compiler-rt']) | 210 RunCommand(GetVSVersion().SetupScript('x86') + ['&&', 'ninja', 'compiler-rt']) |
204 | 211 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 268 |
262 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): | 269 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): |
263 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' | 270 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' |
264 return 0 | 271 return 0 |
265 | 272 |
266 return UpdateClang() | 273 return UpdateClang() |
267 | 274 |
268 | 275 |
269 if __name__ == '__main__': | 276 if __name__ == '__main__': |
270 sys.exit(main()) | 277 sys.exit(main()) |
OLD | NEW |