| 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 argparse | 9 import argparse |
| 10 import os | 10 import os |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 aux_sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', | 288 aux_sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', |
| 289 VERSION, 'include_sanitizer', | 289 VERSION, 'include_sanitizer', |
| 290 'sanitizer') | 290 'sanitizer') |
| 291 if not os.path.exists(aux_sanitizer_include_dir): | 291 if not os.path.exists(aux_sanitizer_include_dir): |
| 292 os.makedirs(aux_sanitizer_include_dir) | 292 os.makedirs(aux_sanitizer_include_dir) |
| 293 for _, _, files in os.walk(sanitizer_include_dir): | 293 for _, _, files in os.walk(sanitizer_include_dir): |
| 294 for f in files: | 294 for f in files: |
| 295 CopyFile(os.path.join(sanitizer_include_dir, f), | 295 CopyFile(os.path.join(sanitizer_include_dir, f), |
| 296 aux_sanitizer_include_dir) | 296 aux_sanitizer_include_dir) |
| 297 | 297 |
| 298 if args.run_tests: |
| 299 os.chdir(LLVM_BUILD_DIR) |
| 300 RunCommand(GetVSVersion().SetupScript('x64') + |
| 301 ['&&', 'ninja', 'cr-check-all']) |
| 302 |
| 298 WriteStampFile(LLVM_WIN_REVISION) | 303 WriteStampFile(LLVM_WIN_REVISION) |
| 299 print 'Clang update was successful.' | 304 print 'Clang update was successful.' |
| 300 return 0 | 305 return 0 |
| 301 | 306 |
| 302 | 307 |
| 303 def main(): | 308 def main(): |
| 304 if not sys.platform in ['win32', 'cygwin']: | 309 if not sys.platform in ['win32', 'cygwin']: |
| 305 # For non-Windows, fall back to update.sh. | 310 # For non-Windows, fall back to update.sh. |
| 306 # TODO(hans): Make update.py replace update.sh completely. | 311 # TODO(hans): Make update.py replace update.sh completely. |
| 307 | 312 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 322 [os.path.join(os.path.dirname(__file__), 'update.sh')] + sys.argv[1:], | 327 [os.path.join(os.path.dirname(__file__), 'update.sh')] + sys.argv[1:], |
| 323 stderr=stderr) | 328 stderr=stderr) |
| 324 | 329 |
| 325 parser = argparse.ArgumentParser(description='Build Clang.') | 330 parser = argparse.ArgumentParser(description='Build Clang.') |
| 326 parser.add_argument('--tools', nargs='*', | 331 parser.add_argument('--tools', nargs='*', |
| 327 default=['plugins', 'blink_gc_plugin']) | 332 default=['plugins', 'blink_gc_plugin']) |
| 328 # For now, this flag is only used for the non-Windows flow, but argparser gets | 333 # For now, this flag is only used for the non-Windows flow, but argparser gets |
| 329 # mad if it sees a flag it doesn't recognize. | 334 # mad if it sees a flag it doesn't recognize. |
| 330 parser.add_argument('--if-needed', action='store_true') | 335 parser.add_argument('--if-needed', action='store_true') |
| 331 parser.add_argument('--print-revision', action='store_true') | 336 parser.add_argument('--print-revision', action='store_true') |
| 337 parser.add_argument('--run-tests', action='store_true') |
| 332 | 338 |
| 333 args = parser.parse_args() | 339 args = parser.parse_args() |
| 334 | 340 |
| 335 if args.print_revision: | 341 if args.print_revision: |
| 336 PrintRevision() | 342 PrintRevision() |
| 337 return 0 | 343 return 0 |
| 338 | 344 |
| 339 if not re.search(r'\b(clang|asan)=1', os.environ.get('GYP_DEFINES', '')): | 345 if not re.search(r'\b(clang|asan)=1', os.environ.get('GYP_DEFINES', '')): |
| 340 print 'Skipping Clang update (clang=1 was not set in GYP_DEFINES).' | 346 print 'Skipping Clang update (clang=1 was not set in GYP_DEFINES).' |
| 341 return 0 | 347 return 0 |
| 342 | 348 |
| 343 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): | 349 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): |
| 344 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' | 350 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' |
| 345 return 0 | 351 return 0 |
| 346 | 352 |
| 347 return UpdateClang(args) | 353 return UpdateClang(args) |
| 348 | 354 |
| 349 | 355 |
| 350 if __name__ == '__main__': | 356 if __name__ == '__main__': |
| 351 sys.exit(main()) | 357 sys.exit(main()) |
| OLD | NEW |