| 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 |
| 11 import re | 11 import re |
| 12 import subprocess | 12 import subprocess |
| 13 import sys | 13 import sys |
| 14 | 14 |
| 15 | 15 |
| 16 # Files and directories that are *skipped* by cpplint in the presubmit script. | 16 # Files and directories that are *skipped* by cpplint in the presubmit script. |
| 17 CPPLINT_BLACKLIST = [ | 17 CPPLINT_BLACKLIST = [ |
| 18 'tools-webrtc', | 18 'tools_webrtc', |
| 19 'webrtc/api/video_codecs/video_decoder.h', | 19 'webrtc/api/video_codecs/video_decoder.h', |
| 20 'webrtc/api/video_codecs/video_encoder.h', | 20 'webrtc/api/video_codecs/video_encoder.h', |
| 21 'webrtc/base', | 21 'webrtc/base', |
| 22 'webrtc/examples/objc', | 22 'webrtc/examples/objc', |
| 23 'webrtc/media', | 23 'webrtc/media', |
| 24 'webrtc/modules/audio_coding', | 24 'webrtc/modules/audio_coding', |
| 25 'webrtc/modules/audio_conference_mixer', | 25 'webrtc/modules/audio_conference_mixer', |
| 26 'webrtc/modules/audio_device', | 26 'webrtc/modules/audio_device', |
| 27 'webrtc/modules/audio_processing', | 27 'webrtc/modules/audio_processing', |
| 28 'webrtc/modules/desktop_capture', | 28 'webrtc/modules/desktop_capture', |
| (...skipping 296 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', 'check_package_boundaries.py') |
| 336 webrtc_path = os.path.join('webrtc') | 336 webrtc_path = os.path.join('webrtc') |
| 337 command = [sys.executable, script_path, webrtc_path] | 337 command = [sys.executable, script_path, webrtc_path] |
| 338 command += [gn_file.LocalPath() for gn_file in gn_files] | 338 command += [gn_file.LocalPath() for gn_file in gn_files] |
| 339 returncode, _, stderr = _RunCommand(command, cwd) | 339 returncode, _, stderr = _RunCommand(command, cwd) |
| 340 if returncode: | 340 if returncode: |
| 341 return [output_api.PresubmitError( | 341 return [output_api.PresubmitError( |
| 342 'There are package boundary violations in the following GN files:\n\n' | 342 'There are package boundary violations in the following GN files:\n\n' |
| 343 '%s' % stderr)] | 343 '%s' % stderr)] |
| 344 return [] | 344 return [] |
| 345 | 345 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 467 |
| 468 def _RunPythonTests(input_api, output_api): | 468 def _RunPythonTests(input_api, output_api): |
| 469 def Join(*args): | 469 def Join(*args): |
| 470 return input_api.os_path.join(input_api.PresubmitLocalPath(), *args) | 470 return input_api.os_path.join(input_api.PresubmitLocalPath(), *args) |
| 471 | 471 |
| 472 test_directories = [ | 472 test_directories = [ |
| 473 Join('webrtc', 'tools', 'py_event_log_analyzer'), | 473 Join('webrtc', 'tools', 'py_event_log_analyzer'), |
| 474 Join('webrtc', 'tools'), | 474 Join('webrtc', 'tools'), |
| 475 Join('webrtc', 'audio', 'test', 'unittests'), | 475 Join('webrtc', 'audio', 'test', 'unittests'), |
| 476 ] + [ | 476 ] + [ |
| 477 root for root, _, files in os.walk(Join('tools-webrtc')) | 477 root for root, _, files in os.walk(Join('tools_webrtc')) |
| 478 if any(f.endswith('_test.py') for f in files) | 478 if any(f.endswith('_test.py') for f in files) |
| 479 ] | 479 ] |
| 480 | 480 |
| 481 tests = [] | 481 tests = [] |
| 482 for directory in test_directories: | 482 for directory in test_directories: |
| 483 tests.extend( | 483 tests.extend( |
| 484 input_api.canned_checks.GetUnitTestsInDirectory( | 484 input_api.canned_checks.GetUnitTestsInDirectory( |
| 485 input_api, | 485 input_api, |
| 486 output_api, | 486 output_api, |
| 487 directory, | 487 directory, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 black_list=(r'^base[\\\/].*\.py$', | 526 black_list=(r'^base[\\\/].*\.py$', |
| 527 r'^build[\\\/].*\.py$', | 527 r'^build[\\\/].*\.py$', |
| 528 r'^buildtools[\\\/].*\.py$', | 528 r'^buildtools[\\\/].*\.py$', |
| 529 r'^infra[\\\/].*\.py$', | 529 r'^infra[\\\/].*\.py$', |
| 530 r'^ios[\\\/].*\.py$', | 530 r'^ios[\\\/].*\.py$', |
| 531 r'^out.*[\\\/].*\.py$', | 531 r'^out.*[\\\/].*\.py$', |
| 532 r'^testing[\\\/].*\.py$', | 532 r'^testing[\\\/].*\.py$', |
| 533 r'^third_party[\\\/].*\.py$', | 533 r'^third_party[\\\/].*\.py$', |
| 534 r'^tools[\\\/].*\.py$', | 534 r'^tools[\\\/].*\.py$', |
| 535 # TODO(phoglund): should arguably be checked. | 535 # TODO(phoglund): should arguably be checked. |
| 536 r'^tools-webrtc[\\\/]mb[\\\/].*\.py$', | 536 r'^tools_webrtc[\\\/]mb[\\\/].*\.py$', |
| 537 r'^tools-webrtc[\\\/]valgrind[\\\/].*\.py$', | 537 r'^tools_webrtc[\\\/]valgrind[\\\/].*\.py$', |
| 538 r'^xcodebuild.*[\\\/].*\.py$',), | 538 r'^xcodebuild.*[\\\/].*\.py$',), |
| 539 pylintrc='pylintrc')) | 539 pylintrc='pylintrc')) |
| 540 | 540 |
| 541 # TODO(nisse): talk/ is no more, so make below checks simpler? | 541 # TODO(nisse): talk/ is no more, so make below checks simpler? |
| 542 # WebRTC can't use the presubmit_canned_checks.PanProjectChecks function since | 542 # WebRTC can't use the presubmit_canned_checks.PanProjectChecks function since |
| 543 # we need to have different license checks in talk/ and webrtc/ directories. | 543 # we need to have different license checks in talk/ and webrtc/ directories. |
| 544 # Instead, hand-picked checks are included below. | 544 # Instead, hand-picked checks are included below. |
| 545 | 545 |
| 546 # .m and .mm files are ObjC files. For simplicity we will consider .h files in | 546 # .m and .mm files are ObjC files. For simplicity we will consider .h files in |
| 547 # ObjC subdirectories ObjC headers. | 547 # ObjC subdirectories ObjC headers. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 input_api, output_api)) | 595 input_api, output_api)) |
| 596 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 596 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 597 input_api, output_api)) | 597 input_api, output_api)) |
| 598 results.extend(_CheckChangeHasBugField(input_api, output_api)) | 598 results.extend(_CheckChangeHasBugField(input_api, output_api)) |
| 599 results.extend(input_api.canned_checks.CheckChangeHasTestField( | 599 results.extend(input_api.canned_checks.CheckChangeHasTestField( |
| 600 input_api, output_api)) | 600 input_api, output_api)) |
| 601 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 601 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
| 602 input_api, output_api, | 602 input_api, output_api, |
| 603 json_url='http://webrtc-status.appspot.com/current?format=json')) | 603 json_url='http://webrtc-status.appspot.com/current?format=json')) |
| 604 return results | 604 return results |
| OLD | NEW |