Chromium Code Reviews| 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 + | |
| 723 _TEST_CODE_EXCLUDED_PATHS + | |
|
Nico
2014/08/15 18:25:59
This one doesn't look right. We care about include
| |
| 724 input_api.DEFAULT_BLACK_LIST) | |
| 725 return input_api.FilterSourceFile( | |
| 726 affected_file, | |
| 727 black_list=black_list) | |
| 721 | 728 |
| 722 warnings = [] | 729 warnings = [] |
| 723 for f in input_api.AffectedFiles(): | 730 for f in input_api.AffectedFiles(file_filter=FileFilterIncludeOrder): |
| 724 if f.LocalPath().endswith(('.cc', '.h')): | 731 if f.LocalPath().endswith(('.cc', '.h')): |
| 725 changed_linenums = set(line_num for line_num, _ in f.ChangedContents()) | 732 changed_linenums = set(line_num for line_num, _ in f.ChangedContents()) |
| 726 warnings.extend(_CheckIncludeOrderInFile(input_api, f, changed_linenums)) | 733 warnings.extend(_CheckIncludeOrderInFile(input_api, f, changed_linenums)) |
| 727 | 734 |
| 728 results = [] | 735 results = [] |
| 729 if warnings: | 736 if warnings: |
| 730 results.append(output_api.PresubmitPromptOrNotify(_INCLUDE_ORDER_WARNING, | 737 results.append(output_api.PresubmitPromptOrNotify(_INCLUDE_ORDER_WARNING, |
| 731 warnings)) | 738 warnings)) |
| 732 return results | 739 return results |
| 733 | 740 |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1627 builders.extend(['cros_x86']) | 1634 builders.extend(['cros_x86']) |
| 1628 | 1635 |
| 1629 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it | 1636 # 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 | 1637 # unless they're .gyp(i) files as changes to those files can break the gyp |
| 1631 # step on that bot. | 1638 # step on that bot. |
| 1632 if (not all(re.search('^chrome', f) for f in files) or | 1639 if (not all(re.search('^chrome', f) for f in files) or |
| 1633 any(re.search('\.gypi?$', f) for f in files)): | 1640 any(re.search('\.gypi?$', f) for f in files)): |
| 1634 builders.extend(['android_aosp']) | 1641 builders.extend(['android_aosp']) |
| 1635 | 1642 |
| 1636 return GetDefaultTryConfigs(builders) | 1643 return GetDefaultTryConfigs(builders) |
| OLD | NEW |