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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
711 """Checks that the #include order is correct. | 711 """Checks that the #include order is correct. |
712 | 712 |
713 1. The corresponding header for source files. | 713 1. The corresponding header for source files. |
714 2. C system files in alphabetical order | 714 2. C system files in alphabetical order |
715 3. C++ system files in alphabetical order | 715 3. C++ system files in alphabetical order |
716 4. Project's .h files in alphabetical order | 716 4. Project's .h files in alphabetical order |
717 | 717 |
718 Each region separated by #if, #elif, #else, #endif, #define and #undef follows | 718 Each region separated by #if, #elif, #else, #endif, #define and #undef follows |
719 these rules separately. | 719 these rules separately. |
720 """ | 720 """ |
721 def FileFilterIncludeOrder(affected_file): | |
722 black_list = (_EXCLUDED_PATHS + | |
M-A Ruel
2014/08/15 18:50:29
it fits 80 cols?
| |
723 input_api.DEFAULT_BLACK_LIST) | |
724 return input_api.FilterSourceFile( | |
725 affected_file, | |
M-A Ruel
2014/08/15 18:50:29
fit 80 cols? Otherwise align at +4.
| |
726 black_list=black_list) | |
721 | 727 |
722 warnings = [] | 728 warnings = [] |
723 for f in input_api.AffectedFiles(): | 729 for f in input_api.AffectedFiles(file_filter=FileFilterIncludeOrder): |
724 if f.LocalPath().endswith(('.cc', '.h')): | 730 if f.LocalPath().endswith(('.cc', '.h')): |
725 changed_linenums = set(line_num for line_num, _ in f.ChangedContents()) | 731 changed_linenums = set(line_num for line_num, _ in f.ChangedContents()) |
726 warnings.extend(_CheckIncludeOrderInFile(input_api, f, changed_linenums)) | 732 warnings.extend(_CheckIncludeOrderInFile(input_api, f, changed_linenums)) |
727 | 733 |
728 results = [] | 734 results = [] |
729 if warnings: | 735 if warnings: |
730 results.append(output_api.PresubmitPromptOrNotify(_INCLUDE_ORDER_WARNING, | 736 results.append(output_api.PresubmitPromptOrNotify(_INCLUDE_ORDER_WARNING, |
731 warnings)) | 737 warnings)) |
732 return results | 738 return results |
733 | 739 |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1627 builders.extend(['cros_x86']) | 1633 builders.extend(['cros_x86']) |
1628 | 1634 |
1629 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it | 1635 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it |
1630 # unless they're .gyp(i) files as changes to those files can break the gyp | 1636 # unless they're .gyp(i) files as changes to those files can break the gyp |
1631 # step on that bot. | 1637 # step on that bot. |
1632 if (not all(re.search('^chrome', f) for f in files) or | 1638 if (not all(re.search('^chrome', f) for f in files) or |
1633 any(re.search('\.gypi?$', f) for f in files)): | 1639 any(re.search('\.gypi?$', f) for f in files)): |
1634 builders.extend(['android_aosp']) | 1640 builders.extend(['android_aosp']) |
1635 | 1641 |
1636 return GetDefaultTryConfigs(builders) | 1642 return GetDefaultTryConfigs(builders) |
OLD | NEW |