OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Without any args, this simply loads the IDs out of a bunch of the Chrome GRD | 6 """Without any args, this simply loads the IDs out of a bunch of the Chrome GRD |
7 files, and then checks the subset of the code that loads the strings to try | 7 files, and then checks the subset of the code that loads the strings to try |
8 and figure out what isn't in use any more. | 8 and figure out what isn't in use any more. |
9 You can give paths to GRD files and source directories to control what is | 9 You can give paths to GRD files and source directories to control what is |
10 check instead. | 10 check instead. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 src_dirs = [] | 119 src_dirs = [] |
120 grd_files = [] | 120 grd_files = [] |
121 for arg in sys.argv[1:]: | 121 for arg in sys.argv[1:]: |
122 if arg.lower().endswith('.grd'): | 122 if arg.lower().endswith('.grd'): |
123 grd_files.append(arg) | 123 grd_files.append(arg) |
124 else: | 124 else: |
125 src_dirs.append(arg) | 125 src_dirs.append(arg) |
126 | 126 |
127 # If no GRD files were given, default them: | 127 # If no GRD files were given, default them: |
128 if len(grd_files) == 0: | 128 if len(grd_files) == 0: |
| 129 ash_base_dir = os.path.join(src_dir, 'ash') |
129 chrome_dir = os.path.join(src_dir, 'chrome') | 130 chrome_dir = os.path.join(src_dir, 'chrome') |
130 chrome_app_dir = os.path.join(chrome_dir, 'app') | 131 chrome_app_dir = os.path.join(chrome_dir, 'app') |
131 chrome_app_res_dir = os.path.join(chrome_app_dir, 'resources') | 132 chrome_app_res_dir = os.path.join(chrome_app_dir, 'resources') |
132 ui_base_dir = os.path.join(src_dir, 'ui', 'base', 'strings') | 133 ui_base_dir = os.path.join(src_dir, 'ui', 'base', 'strings') |
133 grd_files = [ | 134 grd_files = [ |
| 135 os.path.join(ash_base_dir, 'ash_strings.grd'), |
134 os.path.join(chrome_app_dir, 'chromium_strings.grd'), | 136 os.path.join(chrome_app_dir, 'chromium_strings.grd'), |
135 os.path.join(chrome_app_dir, 'generated_resources.grd'), | 137 os.path.join(chrome_app_dir, 'generated_resources.grd'), |
136 os.path.join(chrome_app_dir, 'google_chrome_strings.grd'), | 138 os.path.join(chrome_app_dir, 'google_chrome_strings.grd'), |
137 os.path.join(chrome_app_res_dir, 'locale_settings.grd'), | 139 os.path.join(chrome_app_res_dir, 'locale_settings.grd'), |
138 os.path.join(chrome_app_res_dir, 'locale_settings_cros.grd'), | 140 os.path.join(chrome_app_res_dir, 'locale_settings_cros.grd'), |
139 os.path.join(chrome_app_res_dir, 'locale_settings_linux.grd'), | 141 os.path.join(chrome_app_res_dir, 'locale_settings_linux.grd'), |
140 os.path.join(chrome_app_res_dir, 'locale_settings_mac.grd'), | 142 os.path.join(chrome_app_res_dir, 'locale_settings_mac.grd'), |
141 os.path.join(chrome_app_res_dir, 'locale_settings_win.grd'), | 143 os.path.join(chrome_app_res_dir, 'locale_settings_win.grd'), |
142 os.path.join(chrome_app_dir, 'theme', 'theme_resources.grd'), | 144 os.path.join(chrome_app_dir, 'theme', 'theme_resources.grd'), |
143 os.path.join(chrome_dir, 'browser', 'browser_resources.grd'), | 145 os.path.join(chrome_dir, 'browser', 'browser_resources.grd'), |
(...skipping 18 matching lines...) Expand all Loading... |
162 # nsNSSCertHelper.cpp has a bunch of ids | 164 # nsNSSCertHelper.cpp has a bunch of ids |
163 os.path.join(src_dir, 'third_party', 'mozilla_security_manager'), | 165 os.path.join(src_dir, 'third_party', 'mozilla_security_manager'), |
164 os.path.join(chrome_dir, 'installer'), | 166 os.path.join(chrome_dir, 'installer'), |
165 ] | 167 ] |
166 | 168 |
167 return CheckForUnusedGrdIDsInSources(grd_files, src_dirs) | 169 return CheckForUnusedGrdIDsInSources(grd_files, src_dirs) |
168 | 170 |
169 | 171 |
170 if __name__ == '__main__': | 172 if __name__ == '__main__': |
171 sys.exit(main()) | 173 sys.exit(main()) |
OLD | NEW |