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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 with open('tools/metrics/actions/chromeactions.txt') as f: | 1023 with open('tools/metrics/actions/chromeactions.txt') as f: |
1024 current_actions = f.read() | 1024 current_actions = f.read() |
1025 | 1025 |
1026 file_filter = lambda f: f.LocalPath().endswith(('.cc', '.mm')) | 1026 file_filter = lambda f: f.LocalPath().endswith(('.cc', '.mm')) |
1027 action_re = r'[^a-zA-Z]UserMetricsAction\("([^"]*)' | 1027 action_re = r'[^a-zA-Z]UserMetricsAction\("([^"]*)' |
1028 for f in input_api.AffectedFiles(file_filter=file_filter): | 1028 for f in input_api.AffectedFiles(file_filter=file_filter): |
1029 for line_num, line in f.ChangedContents(): | 1029 for line_num, line in f.ChangedContents(): |
1030 match = input_api.re.search(action_re, line) | 1030 match = input_api.re.search(action_re, line) |
1031 if match: | 1031 if match: |
1032 for action_name in match.groups(): | 1032 for action_name in match.groups(): |
1033 name_pattern = r'\t%s\n' % action_name | 1033 name_pattern = '\t%s\n' % action_name |
1034 if name_pattern not in current_actions: | 1034 if name_pattern not in current_actions: |
1035 return [output_api.PresubmitPromptWarning( | 1035 return [output_api.PresubmitPromptWarning( |
1036 'File %s line %d: %s is missing in ' | 1036 'File %s line %d: %s is missing in ' |
1037 'tools/metrics/actions/chromeactions.txt. Please run ' | 1037 'tools/metrics/actions/chromeactions.txt. Please run ' |
1038 'tools/metrics/actions/extract_actions.py --hash to update.' | 1038 'tools/metrics/actions/extract_actions.py --hash to update.' |
1039 % (f.LocalPath(), line_num, action_name))] | 1039 % (f.LocalPath(), line_num, action_name))] |
1040 return [] | 1040 return [] |
1041 | 1041 |
1042 | 1042 |
1043 def _CheckJavaStyle(input_api, output_api): | 1043 def _CheckJavaStyle(input_api, output_api): |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 trybots.extend(GetDefaultTryConfigs(['cros_x86'])) | 1451 trybots.extend(GetDefaultTryConfigs(['cros_x86'])) |
1452 | 1452 |
1453 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it | 1453 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it |
1454 # unless they're .gyp(i) files as changes to those files can break the gyp | 1454 # unless they're .gyp(i) files as changes to those files can break the gyp |
1455 # step on that bot. | 1455 # step on that bot. |
1456 if (not all(re.search('^chrome', f) for f in files) or | 1456 if (not all(re.search('^chrome', f) for f in files) or |
1457 any(re.search('\.gypi?$', f) for f in files)): | 1457 any(re.search('\.gypi?$', f) for f in files)): |
1458 trybots.extend(GetDefaultTryConfigs(['android_aosp'])) | 1458 trybots.extend(GetDefaultTryConfigs(['android_aosp'])) |
1459 | 1459 |
1460 return trybots | 1460 return trybots |
OLD | NEW |