OLD | NEW |
1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license |
4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source |
5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found |
6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
8 | 8 |
9 import json | 9 import json |
10 import os | 10 import os |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 'GN targets cannot mix .cc and .c source files. Please create a ' | 325 'GN targets cannot mix .cc and .c source files. Please create a ' |
326 'separate target for each collection of sources.\n' | 326 'separate target for each collection of sources.\n' |
327 'Mixed sources: \n' | 327 'Mixed sources: \n' |
328 '%s\n' | 328 '%s\n' |
329 'Violating GN files:' % json.dumps(violating_gn_files, indent=2), | 329 'Violating GN files:' % json.dumps(violating_gn_files, indent=2), |
330 items=violating_gn_files.keys())] | 330 items=violating_gn_files.keys())] |
331 return [] | 331 return [] |
332 | 332 |
333 def _CheckNoPackageBoundaryViolations(input_api, gn_files, output_api): | 333 def _CheckNoPackageBoundaryViolations(input_api, gn_files, output_api): |
334 cwd = input_api.PresubmitLocalPath() | 334 cwd = input_api.PresubmitLocalPath() |
335 script_path = os.path.join('tools_webrtc', 'check_package_boundaries.py') | 335 script_path = os.path.join('tools_webrtc', 'presubmit_checks_lib', |
| 336 'check_package_boundaries.py') |
336 webrtc_path = os.path.join('webrtc') | 337 webrtc_path = os.path.join('webrtc') |
337 command = [sys.executable, script_path, webrtc_path] | 338 command = [sys.executable, script_path, webrtc_path] |
338 command += [gn_file.LocalPath() for gn_file in gn_files] | 339 command += [gn_file.LocalPath() for gn_file in gn_files] |
339 returncode, _, stderr = _RunCommand(command, cwd) | 340 returncode, _, stderr = _RunCommand(command, cwd) |
340 if returncode: | 341 if returncode: |
341 return [output_api.PresubmitError( | 342 return [output_api.PresubmitError( |
342 'There are package boundary violations in the following GN files:\n\n' | 343 'There are package boundary violations in the following GN files:\n\n' |
343 '%s' % stderr)] | 344 '%s' % stderr)] |
344 return [] | 345 return [] |
345 | 346 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 if f.LocalPath().endswith('.h') and f.Action() == 'A': | 630 if f.LocalPath().endswith('.h') and f.Action() == 'A': |
630 file_path = os.path.abspath(f.LocalPath()) | 631 file_path = os.path.abspath(f.LocalPath()) |
631 root_dir = os.getcwd() | 632 root_dir = os.getcwd() |
632 gn_file_path = GetBuildGnPathFromFilePath(file_path, os.path.exists, | 633 gn_file_path = GetBuildGnPathFromFilePath(file_path, os.path.exists, |
633 root_dir) | 634 root_dir) |
634 in_build_gn = IsHeaderInBuildGn(file_path, gn_file_path) | 635 in_build_gn = IsHeaderInBuildGn(file_path, gn_file_path) |
635 if not in_build_gn: | 636 if not in_build_gn: |
636 results.append(output_api.PresubmitError(error_msg.format( | 637 results.append(output_api.PresubmitError(error_msg.format( |
637 file_path, gn_file_path))) | 638 file_path, gn_file_path))) |
638 return results | 639 return results |
OLD | NEW |