| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 285 |
| 286 | 286 |
| 287 def _CheckNoNewWStrings(input_api, output_api): | 287 def _CheckNoNewWStrings(input_api, output_api): |
| 288 """Checks to make sure we don't introduce use of wstrings.""" | 288 """Checks to make sure we don't introduce use of wstrings.""" |
| 289 problems = [] | 289 problems = [] |
| 290 for f in input_api.AffectedFiles(): | 290 for f in input_api.AffectedFiles(): |
| 291 if (not f.LocalPath().endswith(('.cc', '.h')) or | 291 if (not f.LocalPath().endswith(('.cc', '.h')) or |
| 292 f.LocalPath().endswith('test.cc')): | 292 f.LocalPath().endswith('test.cc')): |
| 293 continue | 293 continue |
| 294 | 294 |
| 295 allowWString = False |
| 295 for line_num, line in f.ChangedContents(): | 296 for line_num, line in f.ChangedContents(): |
| 296 if 'wstring' in line: | 297 if 'presubmit: allow wstring' in line: |
| 298 allowWString = True |
| 299 elif not allowWString and 'wstring' in line: |
| 297 problems.append(' %s:%d' % (f.LocalPath(), line_num)) | 300 problems.append(' %s:%d' % (f.LocalPath(), line_num)) |
| 301 allowWString = False |
| 302 else: |
| 303 allowWString = False |
| 298 | 304 |
| 299 if not problems: | 305 if not problems: |
| 300 return [] | 306 return [] |
| 301 return [output_api.PresubmitPromptWarning('New code should not use wstrings.' | 307 return [output_api.PresubmitPromptWarning('New code should not use wstrings.' |
| 302 ' If you are calling an API that accepts a wstring, fix the API.\n' + | 308 ' If you are calling a cross-platform API that accepts a wstring, ' |
| 309 'fix the API.\n' + |
| 303 '\n'.join(problems))] | 310 '\n'.join(problems))] |
| 304 | 311 |
| 305 | 312 |
| 306 def _CheckNoDEPSGIT(input_api, output_api): | 313 def _CheckNoDEPSGIT(input_api, output_api): |
| 307 """Make sure .DEPS.git is never modified manually.""" | 314 """Make sure .DEPS.git is never modified manually.""" |
| 308 if any(f.LocalPath().endswith('.DEPS.git') for f in | 315 if any(f.LocalPath().endswith('.DEPS.git') for f in |
| 309 input_api.AffectedFiles()): | 316 input_api.AffectedFiles()): |
| 310 return [output_api.PresubmitError( | 317 return [output_api.PresubmitError( |
| 311 'Never commit changes to .DEPS.git. This file is maintained by an\n' | 318 'Never commit changes to .DEPS.git. This file is maintained by an\n' |
| 312 'automated system based on what\'s in DEPS and your changes will be\n' | 319 'automated system based on what\'s in DEPS and your changes will be\n' |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 | 572 |
| 566 trybots = ['win_rel', 'linux_rel', 'mac_rel', 'linux_clang:compile', | 573 trybots = ['win_rel', 'linux_rel', 'mac_rel', 'linux_clang:compile', |
| 567 'android'] | 574 'android'] |
| 568 | 575 |
| 569 # Match things like path/aura/file.cc and path/file_aura.cc. | 576 # Match things like path/aura/file.cc and path/file_aura.cc. |
| 570 # Same for chromeos. | 577 # Same for chromeos. |
| 571 if any(re.search('[/_](aura|chromeos)', f) for f in files): | 578 if any(re.search('[/_](aura|chromeos)', f) for f in files): |
| 572 trybots += ['linux_chromeos', 'linux_chromeos_clang:compile'] | 579 trybots += ['linux_chromeos', 'linux_chromeos_clang:compile'] |
| 573 | 580 |
| 574 return trybots | 581 return trybots |
| OLD | NEW |