OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 '''Uses the closure compiler to check the ChromeVox javascript files. | 7 '''Uses the closure compiler to check the ChromeVox javascript files. |
8 | 8 |
9 With no arguments, checks all ChromeVox scripts. If any arguments are | 9 With no arguments, checks all ChromeVox scripts. If any arguments are |
10 specified, only scripts that include any of the specified files will be | 10 specified, only scripts that include any of the specified files will be |
(...skipping 27 matching lines...) Expand all Loading... |
38 '''Converts a path relative to the top-level chromevox directory to a | 38 '''Converts a path relative to the top-level chromevox directory to a |
39 path relative to the current directory. | 39 path relative to the current directory. |
40 ''' | 40 ''' |
41 return os.path.relpath(os.path.join(_CHROME_SOURCE_DIR, path)) | 41 return os.path.relpath(os.path.join(_CHROME_SOURCE_DIR, path)) |
42 | 42 |
43 | 43 |
44 # Name of chrome extensions externs file. | 44 # Name of chrome extensions externs file. |
45 _CHROME_EXTENSIONS_EXTERNS = ( | 45 _CHROME_EXTENSIONS_EXTERNS = ( |
46 ChromeRootPath('third_party/closure_compiler/externs/chrome_extensions.js')) | 46 ChromeRootPath('third_party/closure_compiler/externs/chrome_extensions.js')) |
47 | 47 |
| 48 # MetricsPrivate externs file. |
| 49 _METRICS_PRIVATE_EXTERNS = ( |
| 50 ChromeRootPath('third_party/closure_compiler/externs/metrics_private.js')) |
| 51 |
| 52 |
48 # Externs common to many ChromeVox scripts. | 53 # Externs common to many ChromeVox scripts. |
49 _COMMON_EXTERNS = [ | 54 _COMMON_EXTERNS = [ |
50 CVoxPath('common/externs.js'), | 55 CVoxPath('common/externs.js'), |
51 CVoxPath('common/chrome_extension_externs.js'), | 56 CVoxPath('common/chrome_extension_externs.js'), |
52 CVoxPath('chromevox/background/externs.js'), | 57 CVoxPath('chromevox/background/externs.js'), |
53 CVoxPath('chromevox/injected/externs.js'), | 58 CVoxPath('chromevox/injected/externs.js'), |
54 CVoxPath('host/chrome/externs.js'), | 59 CVoxPath('host/chrome/externs.js'), |
55 _CHROME_EXTENSIONS_EXTERNS] | 60 _CHROME_EXTENSIONS_EXTERNS, |
| 61 _METRICS_PRIVATE_EXTERNS] |
56 | 62 |
57 # List of top-level scripts and externs that we can check. | 63 # List of top-level scripts and externs that we can check. |
58 _TOP_LEVEL_SCRIPTS = [ | 64 _TOP_LEVEL_SCRIPTS = [ |
59 [[CVoxPath('chromevox/background/kbexplorer_loader.js')], _COMMON_EXTERNS], | 65 [[CVoxPath('chromevox/background/kbexplorer_loader.js')], _COMMON_EXTERNS], |
60 [[CVoxPath('chromevox/background/options_loader.js')], _COMMON_EXTERNS], | 66 [[CVoxPath('chromevox/background/options_loader.js')], _COMMON_EXTERNS], |
61 [[CVoxPath('chromevox/injected/loader.js')], _COMMON_EXTERNS], | 67 [[CVoxPath('chromevox/injected/loader.js')], _COMMON_EXTERNS], |
62 [[CVoxPath('cvox2/background/loader.js')], _COMMON_EXTERNS], | 68 [[CVoxPath('cvox2/background/loader.js')], _COMMON_EXTERNS], |
63 [[CVoxPath('cvox2/background/panel_loader.js')], _COMMON_EXTERNS], | 69 [[CVoxPath('cvox2/background/panel_loader.js')], _COMMON_EXTERNS], |
64 ] | 70 ] |
65 | 71 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 if len(args) > 0: | 137 if len(args) > 0: |
132 changed_paths = (os.path.relpath(p) for p in args) | 138 changed_paths = (os.path.relpath(p) for p in args) |
133 success, output = CheckChromeVox(changed_paths) | 139 success, output = CheckChromeVox(changed_paths) |
134 if len(output) > 0: | 140 if len(output) > 0: |
135 print output | 141 print output |
136 return int(not success) | 142 return int(not success) |
137 | 143 |
138 | 144 |
139 if __name__ == '__main__': | 145 if __name__ == '__main__': |
140 sys.exit(main()) | 146 sys.exit(main()) |
OLD | NEW |