OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 | 183 |
184 def _CheckNoNewOldCallback(input_api, output_api): | 184 def _CheckNoNewOldCallback(input_api, output_api): |
185 """Checks to make sure we don't introduce new uses of old callbacks.""" | 185 """Checks to make sure we don't introduce new uses of old callbacks.""" |
186 | 186 |
187 def HasOldCallbackKeywords(line): | 187 def HasOldCallbackKeywords(line): |
188 """Returns True if a line of text contains keywords that indicate the use | 188 """Returns True if a line of text contains keywords that indicate the use |
189 of the old callback system. | 189 of the old callback system. |
190 """ | 190 """ |
191 return ('NewRunnableMethod' in line or | 191 return ('NewRunnableMethod' in line or |
192 'NewRunnableFunction' in line or | |
193 'NewCallback' in line or | 192 'NewCallback' in line or |
194 input_api.re.search(r'\bCallback\d<', line) or | 193 input_api.re.search(r'\bCallback\d<', line) or |
195 input_api.re.search(r'\bpublic Task\b', line) or | 194 input_api.re.search(r'\bpublic Task\b', line) or |
196 'public CancelableTask' in line) | 195 'public CancelableTask' in line) |
197 | 196 |
198 problems = [] | 197 problems = [] |
199 file_filter = lambda f: f.LocalPath().endswith(('.cc', '.h')) | 198 file_filter = lambda f: f.LocalPath().endswith(('.cc', '.h')) |
200 for f in input_api.AffectedFiles(file_filter=file_filter): | 199 for f in input_api.AffectedFiles(file_filter=file_filter): |
201 if not any(HasOldCallbackKeywords(line) for line in f.NewContents()): | 200 if not any(HasOldCallbackKeywords(line) for line in f.NewContents()): |
202 continue | 201 continue |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 def GetPreferredTrySlaves(project, change): | 335 def GetPreferredTrySlaves(project, change): |
337 only_objc_files = all( | 336 only_objc_files = all( |
338 f.LocalPath().endswith(('.mm', '.m')) for f in change.AffectedFiles()) | 337 f.LocalPath().endswith(('.mm', '.m')) for f in change.AffectedFiles()) |
339 if only_objc_files: | 338 if only_objc_files: |
340 return ['mac_rel'] | 339 return ['mac_rel'] |
341 preferred = ['win_rel', 'linux_rel', 'mac_rel'] | 340 preferred = ['win_rel', 'linux_rel', 'mac_rel'] |
342 aura_re = '_aura[^/]*[.][^/]*' | 341 aura_re = '_aura[^/]*[.][^/]*' |
343 if any(re.search(aura_re, f.LocalPath()) for f in change.AffectedFiles()): | 342 if any(re.search(aura_re, f.LocalPath()) for f in change.AffectedFiles()): |
344 preferred.append('linux_chromeos_aura:compile') | 343 preferred.append('linux_chromeos_aura:compile') |
345 return preferred | 344 return preferred |
OLD | NEW |