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 26 matching lines...) Expand all Loading... |
37 def ChromeRootPath(path='.'): | 37 def ChromeRootPath(path='.'): |
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 # Automation API externs file. | 44 # Automation API externs file. |
45 _AUTOMATION_EXTERNS = ( | 45 _AUTOMATION_EXTERNS = ( |
46 ChromeRootPath('third_party/closure_compiler/externs/automation.js')) | 46 ChromeRootPath('third_party/closure_compiler/externs/automation.js')) |
| 47 _AUTOMATION_CUSTOM_EXTERNS = ( |
| 48 ChromeRootPath('third_party/closure_compiler/externs/automation_custom.js')) |
47 | 49 |
48 # MetricsPrivate externs file. | 50 # MetricsPrivate externs file. |
49 _METRICS_PRIVATE_EXTERNS = ( | 51 _METRICS_PRIVATE_EXTERNS = ( |
50 ChromeRootPath('third_party/closure_compiler/externs/metrics_private.js')) | 52 ChromeRootPath('third_party/closure_compiler/externs/metrics_private.js')) |
51 | 53 |
52 # Additional chrome extension api externs file. | 54 # Additional chrome extension api externs file. |
53 _CHROME_EXTENSIONS_EXTERNS = ( | 55 _CHROME_EXTENSIONS_EXTERNS = ( |
54 ChromeRootPath('third_party/closure_compiler/externs/chrome_extensions.js')) | 56 ChromeRootPath('third_party/closure_compiler/externs/chrome_extensions.js')) |
55 | 57 |
56 | 58 |
57 # Externs common to many ChromeVox scripts. | 59 # Externs common to many ChromeVox scripts. |
58 _COMMON_EXTERNS = [ | 60 _COMMON_EXTERNS = [ |
59 CVoxPath('common/externs.js'), | 61 CVoxPath('common/externs.js'), |
60 CVoxPath('common/chrome_extension_externs.js'), | 62 CVoxPath('common/chrome_extension_externs.js'), |
61 CVoxPath('chromevox/background/externs.js'), | 63 CVoxPath('chromevox/background/externs.js'), |
62 CVoxPath('chromevox/injected/externs.js'), | 64 CVoxPath('chromevox/injected/externs.js'), |
63 CVoxPath('host/chrome/externs.js'), | 65 CVoxPath('host/chrome/externs.js'), |
64 _AUTOMATION_EXTERNS, | 66 _AUTOMATION_EXTERNS, |
| 67 _AUTOMATION_CUSTOM_EXTERNS, |
65 _CHROME_EXTENSIONS_EXTERNS, | 68 _CHROME_EXTENSIONS_EXTERNS, |
66 _METRICS_PRIVATE_EXTERNS] | 69 _METRICS_PRIVATE_EXTERNS] |
67 | 70 |
68 # List of top-level scripts and externs that we can check. | 71 # List of top-level scripts and externs that we can check. |
69 _TOP_LEVEL_SCRIPTS = [ | 72 _TOP_LEVEL_SCRIPTS = [ |
70 [[CVoxPath('chromevox/background/kbexplorer_loader.js')], _COMMON_EXTERNS], | 73 [[CVoxPath('chromevox/background/kbexplorer_loader.js')], _COMMON_EXTERNS], |
71 [[CVoxPath('chromevox/background/options_loader.js')], _COMMON_EXTERNS], | 74 [[CVoxPath('chromevox/background/options_loader.js')], _COMMON_EXTERNS], |
72 [[CVoxPath('chromevox/injected/loader.js')], _COMMON_EXTERNS], | 75 [[CVoxPath('chromevox/injected/loader.js')], _COMMON_EXTERNS], |
73 [[CVoxPath('cvox2/background/loader.js')], _COMMON_EXTERNS], | 76 [[CVoxPath('cvox2/background/loader.js')], _COMMON_EXTERNS], |
74 [[CVoxPath('cvox2/background/panel_loader.js')], _COMMON_EXTERNS], | 77 [[CVoxPath('cvox2/background/panel_loader.js')], _COMMON_EXTERNS], |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 if len(args) > 0: | 145 if len(args) > 0: |
143 changed_paths = (os.path.relpath(p) for p in args) | 146 changed_paths = (os.path.relpath(p) for p in args) |
144 success, output = CheckChromeVox(changed_paths) | 147 success, output = CheckChromeVox(changed_paths) |
145 if len(output) > 0: | 148 if len(output) > 0: |
146 print output | 149 print output |
147 return int(not success) | 150 return int(not success) |
148 | 151 |
149 | 152 |
150 if __name__ == '__main__': | 153 if __name__ == '__main__': |
151 sys.exit(main()) | 154 sys.exit(main()) |
OLD | NEW |