Chromium Code Reviews| 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 |
| 11 import os | |
| 11 import sys | 12 import sys |
| 12 | 13 |
| 13 | 14 |
| 14 _EXCLUDED_PATHS = () | 15 _EXCLUDED_PATHS = () |
| 15 | 16 |
| 16 | 17 |
| 17 def _CheckForVersionControlConflictsInFile(input_api, f): | 18 def _CheckForVersionControlConflictsInFile(input_api, f): |
| 18 pattern = input_api.re.compile('^(?:<<<<<<<|>>>>>>>) |^=======$') | 19 pattern = input_api.re.compile('^(?:<<<<<<<|>>>>>>>) |^=======$') |
| 19 errors = [] | 20 errors = [] |
| 20 for line_num, line in f.ChangedContents(): | 21 for line_num, line in f.ChangedContents(): |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 if not errs: | 107 if not errs: |
| 107 return [output_api.PresubmitError( | 108 return [output_api.PresubmitError( |
| 108 "lint-test-expectations failed " | 109 "lint-test-expectations failed " |
| 109 "to produce output; check by hand. ")] | 110 "to produce output; check by hand. ")] |
| 110 if errs.strip() != 'Lint succeeded.': | 111 if errs.strip() != 'Lint succeeded.': |
| 111 return [output_api.PresubmitError(errs)] | 112 return [output_api.PresubmitError(errs)] |
| 112 return [] | 113 return [] |
| 113 | 114 |
| 114 | 115 |
| 115 def _CheckStyle(input_api, output_api): | 116 def _CheckStyle(input_api, output_api): |
| 117 # Ignore the style check for files that are moved from Chromium side to | |
|
tkent
2016/02/23 08:07:30
Can you borrow the _CheckStyle change of https://c
hajimehoshi
2016/02/23 10:08:51
Done.
| |
| 118 # Blink side. | |
| 119 ignore = [ | |
| 120 # These files were moved from Chromium side (crbug/548254). | |
| 121 # TODO(hajimehoshi): We aim to remove these files since these are glue | |
| 122 # files and no longer needed. | |
| 123 'third_party/WebKit/Source/platform/WebMemoryAllocatorDumpImpl', | |
| 124 'third_party/WebKit/Source/platform/WebMemoryDumpProviderAdapter', | |
| 125 'third_party/WebKit/Source/platform/WebProcessMemoryDumpImpl', | |
| 126 ] | |
| 127 files = [] | |
| 128 for f in input_api.AffectedFiles(): | |
| 129 if any([f.LocalPath().startswith(os.path.normpath(d)) for d in ignore]): | |
| 130 continue | |
| 131 files.append(f.LocalPath()) | |
| 132 | |
| 116 style_checker_path = input_api.os_path.join(input_api.PresubmitLocalPath(), | 133 style_checker_path = input_api.os_path.join(input_api.PresubmitLocalPath(), |
| 117 'Tools', 'Scripts', 'check-webkit-style') | 134 'Tools', 'Scripts', 'check-webkit-style') |
| 118 args = ([input_api.python_executable, style_checker_path, '--diff-files'] | 135 args = ([input_api.python_executable, style_checker_path, '--diff-files'] |
| 119 + [input_api.os_path.join('..', '..', f.LocalPath()) | 136 + [input_api.os_path.join('..', '..', f) for f in files]) |
| 120 for f in input_api.AffectedFiles()]) | |
| 121 results = [] | 137 results = [] |
| 122 | 138 |
| 123 try: | 139 try: |
| 124 child = input_api.subprocess.Popen(args, | 140 child = input_api.subprocess.Popen(args, |
| 125 stderr=input_api.subprocess.PIPE) | 141 stderr=input_api.subprocess.PIPE) |
| 126 _, stderrdata = child.communicate() | 142 _, stderrdata = child.communicate() |
| 127 if child.returncode != 0: | 143 if child.returncode != 0: |
| 128 results.append(output_api.PresubmitError( | 144 results.append(output_api.PresubmitError( |
| 129 'check-webkit-style failed', [stderrdata])) | 145 'check-webkit-style failed', [stderrdata])) |
| 130 except Exception as e: | 146 except Exception as e: |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 for master in masters: | 312 for master in masters: |
| 297 try_config.setdefault(master, {}) | 313 try_config.setdefault(master, {}) |
| 298 for builder in masters[master]: | 314 for builder in masters[master]: |
| 299 # Do not trigger presubmit builders, since they're likely to fail | 315 # Do not trigger presubmit builders, since they're likely to fail |
| 300 # (e.g. OWNERS checks before finished code review), and we're | 316 # (e.g. OWNERS checks before finished code review), and we're |
| 301 # running local presubmit anyway. | 317 # running local presubmit anyway. |
| 302 if 'presubmit' not in builder: | 318 if 'presubmit' not in builder: |
| 303 try_config[master][builder] = ['defaulttests'] | 319 try_config[master][builder] = ['defaulttests'] |
| 304 | 320 |
| 305 return try_config | 321 return try_config |
| OLD | NEW |