| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Top-level presubmit script for Chromium. | 5 """Top-level presubmit script for Chromium. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 for more details about the presubmit API built into gcl. | 8 for more details about the presubmit API built into gcl. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 input_api, output_api)) | 426 input_api, output_api)) |
| 427 results.extend(input_api.canned_checks.CheckChangeHasTestField( | 427 results.extend(input_api.canned_checks.CheckChangeHasTestField( |
| 428 input_api, output_api)) | 428 input_api, output_api)) |
| 429 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 429 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 430 input_api, output_api)) | 430 input_api, output_api)) |
| 431 results.extend(_CheckSubversionConfig(input_api, output_api)) | 431 results.extend(_CheckSubversionConfig(input_api, output_api)) |
| 432 return results | 432 return results |
| 433 | 433 |
| 434 | 434 |
| 435 def GetPreferredTrySlaves(project, change): | 435 def GetPreferredTrySlaves(project, change): |
| 436 affected_files = change.LocalPaths() | 436 files = change.LocalPaths() |
| 437 only_objc_files = all(f.endswith(('.mm', '.m')) for f in affected_files) | 437 |
| 438 if only_objc_files: | 438 if all(re.search('\.(m|mm)$|[/_]mac[/_.]', f) for f in files): |
| 439 return ['mac_rel'] | 439 return ['mac_rel'] |
| 440 preferred = ['win_rel', 'linux_rel', 'mac_rel', 'linux_clang:compile'] | 440 if all(re.search('[/_]win[/_.]', f) for f in files): |
| 441 aura_re = '_aura[^/]*[.][^/]*' | 441 return ['win_rel'] |
| 442 if any(re.search(aura_re, f) for f in affected_files): | 442 if all(re.search('[/_]android[/_.]', f) for f in files): |
| 443 preferred.append('linux_chromeos') | 443 return ['android'] |
| 444 # Nothing in chrome/ | 444 |
| 445 android_re_list = ('^base/', | 445 trybots = ['win_rel', 'linux_rel', 'mac_rel', 'linux_clang:compile'] |
| 446 '^build/common.gypi$', | 446 # match things like aurax11.cc or aura_oak.cc |
| 447 '^content/', | 447 if any(re.search('[/_]aura', f) for f in files): |
| 448 '^ipc/', | 448 trybots.append('linux_chromeos') |
| 449 '^jingle/', | 449 |
| 450 '^media/', | 450 # Ensure CL contains some relevant files (i.e. not purely ^chrome) |
| 451 '^net/', | 451 if any(re.search('^(base|build|content|ipc|jingle|media|net|sql)/', f) |
| 452 '^sql/') | 452 for f in files): |
| 453 # Nothing that looks like win-only or aura-only | 453 trybots.append('android') |
| 454 win_re = '_win\.(cc|h)$' | 454 |
| 455 possibly_android = True | 455 return trybots |
| 456 for non_android_re in (aura_re, win_re): | |
| 457 if all(re.search(non_android_re, f) for f in affected_files): | |
| 458 possibly_android = False | |
| 459 break | |
| 460 if possibly_android: | |
| 461 for f in change.AffectedFiles(): | |
| 462 if any(re.search(r, f.LocalPath()) for r in android_re_list): | |
| 463 preferred.append('android') | |
| 464 break | |
| 465 return preferred | |
| OLD | NEW |