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 10 matching lines...) Expand all Loading... |
21 r"^native_client_sdk[\\\/]src[\\\/]tools[\\\/].*.mk", | 21 r"^native_client_sdk[\\\/]src[\\\/]tools[\\\/].*.mk", |
22 r"^net[\\\/]tools[\\\/]spdyshark[\\\/].*", | 22 r"^net[\\\/]tools[\\\/]spdyshark[\\\/].*", |
23 r"^skia[\\\/].*", | 23 r"^skia[\\\/].*", |
24 r"^v8[\\\/].*", | 24 r"^v8[\\\/].*", |
25 r".*MakeFile$", | 25 r".*MakeFile$", |
26 r".+_autogen\.h$", | 26 r".+_autogen\.h$", |
27 r".+[\\\/]pnacl_shim\.c$", | 27 r".+[\\\/]pnacl_shim\.c$", |
28 r"^gpu[\\\/]config[\\\/].*_list_json\.cc$", | 28 r"^gpu[\\\/]config[\\\/].*_list_json\.cc$", |
29 ) | 29 ) |
30 | 30 |
| 31 # TestRunner library is temporarily excluded from pan-project checks until |
| 32 # it's transitioned to chromium coding style. |
| 33 _TESTRUNNER_PATHS = ( |
| 34 r"^content[\\\/]test[\\\/]layout_tests[\\\/]runner[\\\/].*", |
| 35 r"^content[\\\/]public[\\\/]test[\\\/]layout_tests[\\\/].*", |
| 36 ) |
| 37 |
31 # Fragment of a regular expression that matches C++ and Objective-C++ | 38 # Fragment of a regular expression that matches C++ and Objective-C++ |
32 # implementation files. | 39 # implementation files. |
33 _IMPLEMENTATION_EXTENSIONS = r'\.(cc|cpp|cxx|mm)$' | 40 _IMPLEMENTATION_EXTENSIONS = r'\.(cc|cpp|cxx|mm)$' |
34 | 41 |
35 # Regular expression that matches code only used for test binaries | 42 # Regular expression that matches code only used for test binaries |
36 # (best effort). | 43 # (best effort). |
37 _TEST_CODE_EXCLUDED_PATHS = ( | 44 _TEST_CODE_EXCLUDED_PATHS = ( |
38 r'.*[/\\](fake_|test_|mock_).+%s' % _IMPLEMENTATION_EXTENSIONS, | 45 r'.*[/\\](fake_|test_|mock_).+%s' % _IMPLEMENTATION_EXTENSIONS, |
39 r'.+_test_(base|support|util)%s' % _IMPLEMENTATION_EXTENSIONS, | 46 r'.+_test_(base|support|util)%s' % _IMPLEMENTATION_EXTENSIONS, |
40 r'.+_(api|browser|perf|pixel|unit|ui)?test(_[a-z]+)?%s' % | 47 r'.+_(api|browser|perf|pixel|unit|ui)?test(_[a-z]+)?%s' % |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 sys.path = original_sys_path | 999 sys.path = original_sys_path |
993 | 1000 |
994 return checkstyle.RunCheckstyle( | 1001 return checkstyle.RunCheckstyle( |
995 input_api, output_api, 'tools/android/checkstyle/chromium-style-5.0.xml') | 1002 input_api, output_api, 'tools/android/checkstyle/chromium-style-5.0.xml') |
996 | 1003 |
997 | 1004 |
998 def _CommonChecks(input_api, output_api): | 1005 def _CommonChecks(input_api, output_api): |
999 """Checks common to both upload and commit.""" | 1006 """Checks common to both upload and commit.""" |
1000 results = [] | 1007 results = [] |
1001 results.extend(input_api.canned_checks.PanProjectChecks( | 1008 results.extend(input_api.canned_checks.PanProjectChecks( |
1002 input_api, output_api, excluded_paths=_EXCLUDED_PATHS)) | 1009 input_api, output_api, |
| 1010 excluded_paths=_EXCLUDED_PATHS + _TESTRUNNER_PATHS)) |
1003 results.extend(_CheckAuthorizedAuthor(input_api, output_api)) | 1011 results.extend(_CheckAuthorizedAuthor(input_api, output_api)) |
1004 results.extend( | 1012 results.extend( |
1005 _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api)) | 1013 _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api)) |
1006 results.extend(_CheckNoIOStreamInHeaders(input_api, output_api)) | 1014 results.extend(_CheckNoIOStreamInHeaders(input_api, output_api)) |
1007 results.extend(_CheckNoUNIT_TESTInSourceFiles(input_api, output_api)) | 1015 results.extend(_CheckNoUNIT_TESTInSourceFiles(input_api, output_api)) |
1008 results.extend(_CheckNoNewWStrings(input_api, output_api)) | 1016 results.extend(_CheckNoNewWStrings(input_api, output_api)) |
1009 results.extend(_CheckNoDEPSGIT(input_api, output_api)) | 1017 results.extend(_CheckNoDEPSGIT(input_api, output_api)) |
1010 results.extend(_CheckNoBannedFunctions(input_api, output_api)) | 1018 results.extend(_CheckNoBannedFunctions(input_api, output_api)) |
1011 results.extend(_CheckNoPragmaOnce(input_api, output_api)) | 1019 results.extend(_CheckNoPragmaOnce(input_api, output_api)) |
1012 results.extend(_CheckNoTrinaryTrueFalse(input_api, output_api)) | 1020 results.extend(_CheckNoTrinaryTrueFalse(input_api, output_api)) |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 trybots.extend(GetDefaultTryConfigs(['cros_x86'])) | 1458 trybots.extend(GetDefaultTryConfigs(['cros_x86'])) |
1451 | 1459 |
1452 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it | 1460 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it |
1453 # unless they're .gyp(i) files as changes to those files can break the gyp | 1461 # unless they're .gyp(i) files as changes to those files can break the gyp |
1454 # step on that bot. | 1462 # step on that bot. |
1455 if (not all(re.search('^chrome', f) for f in files) or | 1463 if (not all(re.search('^chrome', f) for f in files) or |
1456 any(re.search('\.gypi?$', f) for f in files)): | 1464 any(re.search('\.gypi?$', f) for f in files)): |
1457 trybots.extend(GetDefaultTryConfigs(['android_aosp'])) | 1465 trybots.extend(GetDefaultTryConfigs(['android_aosp'])) |
1458 | 1466 |
1459 return trybots | 1467 return trybots |
OLD | NEW |