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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 affected_files = change.LocalPaths() |
437 only_objc_files = all(f.endswith(('.mm', '.m')) for f in affected_files) | 437 only_objc_files = all(f.endswith(('.mm', '.m')) for f in affected_files) |
438 if only_objc_files: | 438 if only_objc_files: |
439 return ['mac_rel'] | 439 return ['mac_rel'] |
440 android_re = r'/android/|_android(_\w+)?\.\w+$' | |
441 if all(re.search(android_re, f) for f in affected_files): | |
M-A Ruel
2012/06/25 12:15:13
why not?
if all('android' in f for f in affected_f
Isaac (away)
2012/06/25 17:02:17
We could do that, and it'd probably be good enough
| |
442 return ['android'] | |
440 preferred = ['win_rel', 'linux_rel', 'mac_rel', 'linux_clang:compile'] | 443 preferred = ['win_rel', 'linux_rel', 'mac_rel', 'linux_clang:compile'] |
441 aura_re = '_aura[^/]*[.][^/]*' | 444 aura_re = '_aura[^/]*[.]\w+$' |
M-A Ruel
2012/06/25 12:15:13
Reading this regexp, I don't see why '[.]' is used
Isaac (away)
2012/06/25 17:02:17
"." matches any character while [.] or \. match a
M-A Ruel
2012/06/26 13:23:39
optional nit: I really prefer '\.' to '[.]'. '[.]'
| |
442 if any(re.search(aura_re, f) for f in affected_files): | 445 if any(re.search(aura_re, f) for f in affected_files): |
443 preferred.append('linux_chromeos') | 446 preferred.append('linux_chromeos') |
444 # Nothing in chrome/ | 447 # Skip android if everything is aura or windows |
445 android_re_list = ('^base/', | 448 win_or_aura_re = aura_re + '|_win(_\w+)?\.(cc|h)$' |
M-A Ruel
2012/06/25 12:15:13
aura_re already contains a $
Isaac (away)
2012/06/25 17:02:17
There's a pipe symbol which means this is essentia
M-A Ruel
2012/06/26 13:23:39
Ok, but I think it's a loss of readability. I'd pr
| |
446 '^build/common.gypi$', | 449 # Ensure CL contains some relevant files (i.e. not purely ^chrome) |
447 '^content/', | 450 android_maybe_re = ('^base/' |
448 '^ipc/', | 451 '|^build/common.gypi$' |
449 '^jingle/', | 452 '|^content/' |
450 '^media/', | 453 '|^ipc/' |
451 '^net/', | 454 '|^jingle/' |
452 '^sql/') | 455 '|^media/' |
453 # Nothing that looks like win-only or aura-only | 456 '|^net/' |
454 win_re = '_win\.(cc|h)$' | 457 '|^sql/') |
455 possibly_android = True | 458 if (not all(re.search(win_or_aura_re, f) for f in affected_files) |
456 for non_android_re in (aura_re, win_re): | 459 and any(re.search(android_maybe_re, f) for f in affected_files)): |
457 if all(re.search(non_android_re, f) for f in affected_files): | 460 preferred.append('android') |
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 | 461 return preferred |
OLD | NEW |