Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 """Chromium presubmit script for src/extensions/common. | 5 """Chromium presubmit script for src/extensions/common. |
| 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 on the presubmit API built into depot_tools. | 8 for more details on the presubmit API built into depot_tools. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import sys | 11 import sys |
| 12 | 12 |
| 13 | 13 |
| 14 def _CheckExterns(input_api, output_api): | 14 def _CheckExterns(input_api, output_api): |
| 15 original_sys_path = sys.path | 15 original_sys_path = sys.path |
| 16 | 16 |
| 17 join = input_api.os_path.join | 17 join = input_api.os_path.join |
| 18 api_root = input_api.PresubmitLocalPath() | 18 api_root = input_api.PresubmitLocalPath() |
| 19 src_root = join(api_root, '..', '..', '..', '..') | 19 src_root = join(api_root, '..', '..', '..', '..') |
| 20 try: | 20 try: |
| 21 sys.path.append(join(src_root, 'extensions', 'common', 'api')) | 21 sys.path.append(join(src_root, 'extensions', 'common', 'api')) |
| 22 from externs_checker import ExternsChecker | 22 from externs_checker import ExternsChecker |
| 23 finally: | 23 finally: |
| 24 sys.path = original_sys_path | 24 sys.path = original_sys_path |
| 25 | 25 |
| 26 externs_root = join(src_root, 'third_party', 'closure_compiler', 'externs') | 26 externs_root = join(src_root, 'third_party', 'closure_compiler', 'externs') |
| 27 | 27 |
| 28 api_pair_names = { | 28 api_pair_names = { |
| 29 'autofill_private.idl': 'autofill_private.js', | 29 'autofill_private.idl': 'autofill_private.js', |
| 30 'automation.idl': 'automation.js', | |
|
Dan Beam
2017/06/05 17:57:17
this was already done here, btw:
https://coderevie
David Tseng
2017/06/05 18:15:44
Thanks. Fixes to ChromeVox were still needed thoug
| |
| 30 'developer_private.idl': 'developer_private.js', | 31 'developer_private.idl': 'developer_private.js', |
| 31 'bookmark_manager_private.json': 'bookmark_manager_private.js', | 32 'bookmark_manager_private.json': 'bookmark_manager_private.js', |
| 32 'command_line_private.json': 'command_line_private.js', | 33 'command_line_private.json': 'command_line_private.js', |
| 33 'file_manager_private.idl': 'file_manager_private.js', | 34 'file_manager_private.idl': 'file_manager_private.js', |
| 34 'language_settings_private.idl': 'language_settings_private.js', | 35 'language_settings_private.idl': 'language_settings_private.js', |
| 35 'passwords_private.idl': 'passwords_private.js', | 36 'passwords_private.idl': 'passwords_private.js', |
| 36 'system_private.json': 'system_private.js', | 37 'system_private.json': 'system_private.js', |
| 37 'users_private.idl': 'users_private.js', | 38 'users_private.idl': 'users_private.js', |
| 38 # TODO(rdevlin.cronin): Add more! | 39 # TODO(rdevlin.cronin): Add more! |
| 39 } | 40 } |
| 40 normpath = input_api.os_path.normpath | 41 normpath = input_api.os_path.normpath |
| 41 api_pairs = { | 42 api_pairs = { |
| 42 normpath(join(api_root, k)): | 43 normpath(join(api_root, k)): |
| 43 normpath(join(externs_root, v)) for k, v in api_pair_names.items() | 44 normpath(join(externs_root, v)) for k, v in api_pair_names.items() |
| 44 } | 45 } |
| 45 | 46 |
| 46 return ExternsChecker(input_api, output_api, api_pairs).RunChecks() | 47 return ExternsChecker(input_api, output_api, api_pairs).RunChecks() |
| 47 | 48 |
| 48 | 49 |
| 49 def CheckChangeOnUpload(input_api, output_api): | 50 def CheckChangeOnUpload(input_api, output_api): |
| 50 return _CheckExterns(input_api, output_api) | 51 return _CheckExterns(input_api, output_api) |
| OLD | NEW |