OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 Blink. | 5 """Top-level presubmit script for Blink. |
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if errs.strip() != 'Lint succeeded.': | 130 if errs.strip() != 'Lint succeeded.': |
131 return [output_api.PresubmitError(errs)] | 131 return [output_api.PresubmitError(errs)] |
132 return [] | 132 return [] |
133 | 133 |
134 | 134 |
135 def _CheckStyle(input_api, output_api): | 135 def _CheckStyle(input_api, output_api): |
136 # Files that follow Chromium's coding style do not include capital letters. | 136 # Files that follow Chromium's coding style do not include capital letters. |
137 re_chromium_style_file = re.compile(r'\b[a-z_]+\.(cc|h)$') | 137 re_chromium_style_file = re.compile(r'\b[a-z_]+\.(cc|h)$') |
138 style_checker_path = input_api.os_path.join(input_api.PresubmitLocalPath(), | 138 style_checker_path = input_api.os_path.join(input_api.PresubmitLocalPath(), |
139 'Tools', 'Scripts', 'check-webkit-style') | 139 'Tools', 'Scripts', 'check-webkit-style') |
140 args = ([input_api.python_executable, style_checker_path, '--diff-files'] | 140 args = [input_api.python_executable, style_checker_path, '--diff-files'] |
141 + [input_api.os_path.join('..', '..', f.LocalPath()) | 141 files = [input_api.os_path.join('..', '..', f.LocalPath()) |
142 for f in input_api.AffectedFiles() | 142 for f in input_api.AffectedFiles() |
143 # Filter out files that follow Chromium's coding style. | 143 # Filter out files that follow Chromium's coding style. |
144 if not re_chromium_style_file.search(f.LocalPath())]) | 144 if not re_chromium_style_file.search(f.LocalPath())] |
| 145 # Do not call check-webkit-style with empty affected file list if all |
| 146 # input_api.AffectedFiles got filtered. |
| 147 if not files: |
| 148 return [] |
| 149 args += files |
145 results = [] | 150 results = [] |
146 | 151 |
147 try: | 152 try: |
148 child = input_api.subprocess.Popen(args, | 153 child = input_api.subprocess.Popen(args, |
149 stderr=input_api.subprocess.PIPE) | 154 stderr=input_api.subprocess.PIPE) |
150 _, stderrdata = child.communicate() | 155 _, stderrdata = child.communicate() |
151 if child.returncode != 0: | 156 if child.returncode != 0: |
152 results.append(output_api.PresubmitError( | 157 results.append(output_api.PresubmitError( |
153 'check-webkit-style failed', [stderrdata])) | 158 'check-webkit-style failed', [stderrdata])) |
154 except Exception as e: | 159 except Exception as e: |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 new_description = description | 371 new_description = description |
367 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join(bots) | 372 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join(bots) |
368 results.append(output_api.PresubmitNotifyResult( | 373 results.append(output_api.PresubmitNotifyResult( |
369 'Automatically added slimming-paint-v2 tests to run on CQ due to ' | 374 'Automatically added slimming-paint-v2 tests to run on CQ due to ' |
370 'changes in paint or compositing directories.')) | 375 'changes in paint or compositing directories.')) |
371 | 376 |
372 if new_description != description: | 377 if new_description != description: |
373 rietveld_obj.update_description(issue, new_description) | 378 rietveld_obj.update_description(issue, new_description) |
374 | 379 |
375 return results | 380 return results |
OLD | NEW |