Chromium Code Reviews| 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 # Outsource work to gclient verify | 405 # Outsource work to gclient verify |
| 406 try: | 406 try: |
| 407 input_api.subprocess.check_output(['gclient', 'verify']) | 407 input_api.subprocess.check_output(['gclient', 'verify']) |
| 408 return [] | 408 return [] |
| 409 except input_api.subprocess.CalledProcessError, error: | 409 except input_api.subprocess.CalledProcessError, error: |
| 410 return [output_api.PresubmitError( | 410 return [output_api.PresubmitError( |
| 411 'DEPS file must have only git dependencies.', | 411 'DEPS file must have only git dependencies.', |
| 412 long_text=error.output)] | 412 long_text=error.output)] |
| 413 | 413 |
| 414 | 414 |
| 415 def _CheckGNCheck(input_api, output_api): | |
| 416 """Checks that gn gen and gn check pass""" | |
| 417 # TODO(eseidel): We should not have to pass dir= here but unfortunately | |
|
jamesr
2014/10/31 19:57:45
could this be a bug? or do we have a bug?
| |
| 418 # build/config/clang/BUILD.gn:19 rebase_path can't handle absolute paths! | |
| 419 temp_dir = input_api.change.RepositoryRoot() | |
| 420 out_dir = input_api.tempfile.mkdtemp(dir=temp_dir) | |
| 421 relative_out_dir = input_api.os_path.relpath(out_dir) | |
| 422 try: | |
| 423 input_api.subprocess.check_output(['gn', 'gen', relative_out_dir]) | |
| 424 except input_api.subprocess.CalledProcessError, error: | |
| 425 return [output_api.PresubmitError( | |
| 426 'gn gen must not fail.', long_text=error.output)] | |
| 427 | |
| 428 try: | |
| 429 # TODO(eseidel): Currently only //sky/* are known to pass. | |
| 430 input_api.subprocess.check_output(['gn', 'check', relative_out_dir, | |
| 431 '//sky/*']) | |
|
jamesr
2014/10/31 19:57:45
can we make this a list somewhere? i made //mojo/p
| |
| 432 except input_api.subprocess.CalledProcessError, error: | |
| 433 return [output_api.PresubmitError( | |
| 434 'gn check must not fail.', long_text=error.output)] | |
| 435 return [] | |
| 436 | |
| 437 | |
| 415 def _CheckNoBannedFunctions(input_api, output_api): | 438 def _CheckNoBannedFunctions(input_api, output_api): |
| 416 """Make sure that banned functions are not used.""" | 439 """Make sure that banned functions are not used.""" |
| 417 warnings = [] | 440 warnings = [] |
| 418 errors = [] | 441 errors = [] |
| 419 | 442 |
| 420 file_filter = lambda f: f.LocalPath().endswith(('.mm', '.m', '.h')) | 443 file_filter = lambda f: f.LocalPath().endswith(('.mm', '.m', '.h')) |
| 421 for f in input_api.AffectedFiles(file_filter=file_filter): | 444 for f in input_api.AffectedFiles(file_filter=file_filter): |
| 422 for line_num, line in f.ChangedContents(): | 445 for line_num, line in f.ChangedContents(): |
| 423 for func_name, message, error in _BANNED_OBJC_FUNCTIONS: | 446 for func_name, message, error in _BANNED_OBJC_FUNCTIONS: |
| 424 matched = False | 447 matched = False |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1285 output_api, | 1308 output_api, |
| 1286 source_file_filter=lambda x: x.LocalPath().endswith('.grd'))) | 1309 source_file_filter=lambda x: x.LocalPath().endswith('.grd'))) |
| 1287 results.extend(_CheckSpamLogging(input_api, output_api)) | 1310 results.extend(_CheckSpamLogging(input_api, output_api)) |
| 1288 results.extend(_CheckForAnonymousVariables(input_api, output_api)) | 1311 results.extend(_CheckForAnonymousVariables(input_api, output_api)) |
| 1289 results.extend(_CheckCygwinShell(input_api, output_api)) | 1312 results.extend(_CheckCygwinShell(input_api, output_api)) |
| 1290 results.extend(_CheckUserActionUpdate(input_api, output_api)) | 1313 results.extend(_CheckUserActionUpdate(input_api, output_api)) |
| 1291 results.extend(_CheckNoDeprecatedCSS(input_api, output_api)) | 1314 results.extend(_CheckNoDeprecatedCSS(input_api, output_api)) |
| 1292 results.extend(_CheckParseErrors(input_api, output_api)) | 1315 results.extend(_CheckParseErrors(input_api, output_api)) |
| 1293 results.extend(_CheckForIPCRules(input_api, output_api)) | 1316 results.extend(_CheckForIPCRules(input_api, output_api)) |
| 1294 results.extend(_CheckForOverrideAndFinalRules(input_api, output_api)) | 1317 results.extend(_CheckForOverrideAndFinalRules(input_api, output_api)) |
| 1318 results.extend(_CheckGNCheck(input_api, output_api)) | |
| 1295 | 1319 |
| 1296 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()): | 1320 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()): |
| 1297 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( | 1321 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( |
| 1298 input_api, output_api, | 1322 input_api, output_api, |
| 1299 input_api.PresubmitLocalPath(), | 1323 input_api.PresubmitLocalPath(), |
| 1300 whitelist=[r'^PRESUBMIT_test\.py$'])) | 1324 whitelist=[r'^PRESUBMIT_test\.py$'])) |
| 1301 return results | 1325 return results |
| 1302 | 1326 |
| 1303 | 1327 |
| 1304 def _CheckAuthorizedAuthor(input_api, output_api): | 1328 def _CheckAuthorizedAuthor(input_api, output_api): |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1698 builders.extend(['cros_x86']) | 1722 builders.extend(['cros_x86']) |
| 1699 | 1723 |
| 1700 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it | 1724 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it |
| 1701 # unless they're .gyp(i) files as changes to those files can break the gyp | 1725 # unless they're .gyp(i) files as changes to those files can break the gyp |
| 1702 # step on that bot. | 1726 # step on that bot. |
| 1703 if (not all(re.search('^chrome', f) for f in files) or | 1727 if (not all(re.search('^chrome', f) for f in files) or |
| 1704 any(re.search('\.gypi?$', f) for f in files)): | 1728 any(re.search('\.gypi?$', f) for f in files)): |
| 1705 builders.extend(['android_aosp']) | 1729 builders.extend(['android_aosp']) |
| 1706 | 1730 |
| 1707 return GetDefaultTryConfigs(builders) | 1731 return GetDefaultTryConfigs(builders) |
| OLD | NEW |