| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ash_base_dir = os.path.join(src_dir, 'ash') |
| 130 athena_strings_dir = os.path.join(src_dir, 'athena', 'strings') | |
| 131 chrome_dir = os.path.join(src_dir, 'chrome') | 130 chrome_dir = os.path.join(src_dir, 'chrome') |
| 132 chrome_app_dir = os.path.join(chrome_dir, 'app') | 131 chrome_app_dir = os.path.join(chrome_dir, 'app') |
| 133 chrome_app_res_dir = os.path.join(chrome_app_dir, 'resources') | 132 chrome_app_res_dir = os.path.join(chrome_app_dir, 'resources') |
| 134 device_base_dir = os.path.join(src_dir, 'device') | 133 device_base_dir = os.path.join(src_dir, 'device') |
| 135 ui_dir = os.path.join(src_dir, 'ui') | 134 ui_dir = os.path.join(src_dir, 'ui') |
| 136 ui_strings_dir = os.path.join(ui_dir, 'strings') | 135 ui_strings_dir = os.path.join(ui_dir, 'strings') |
| 137 ui_chromeos_dir = os.path.join(ui_dir, 'chromeos') | 136 ui_chromeos_dir = os.path.join(ui_dir, 'chromeos') |
| 138 grd_files = [ | 137 grd_files = [ |
| 139 os.path.join(ash_base_dir, 'ash_strings.grd'), | 138 os.path.join(ash_base_dir, 'ash_strings.grd'), |
| 140 os.path.join(ash_base_dir, 'resources', 'ash_resources.grd'), | 139 os.path.join(ash_base_dir, 'resources', 'ash_resources.grd'), |
| 141 os.path.join(athena_strings_dir, 'athena_strings.grd'), | |
| 142 os.path.join(chrome_app_dir, 'chromium_strings.grd'), | 140 os.path.join(chrome_app_dir, 'chromium_strings.grd'), |
| 143 os.path.join(chrome_app_dir, 'generated_resources.grd'), | 141 os.path.join(chrome_app_dir, 'generated_resources.grd'), |
| 144 os.path.join(chrome_app_dir, 'google_chrome_strings.grd'), | 142 os.path.join(chrome_app_dir, 'google_chrome_strings.grd'), |
| 145 os.path.join(chrome_app_res_dir, 'locale_settings.grd'), | 143 os.path.join(chrome_app_res_dir, 'locale_settings.grd'), |
| 146 os.path.join(chrome_app_res_dir, 'locale_settings_chromiumos.grd'), | 144 os.path.join(chrome_app_res_dir, 'locale_settings_chromiumos.grd'), |
| 147 os.path.join(chrome_app_res_dir, 'locale_settings_google_chromeos.grd'), | 145 os.path.join(chrome_app_res_dir, 'locale_settings_google_chromeos.grd'), |
| 148 os.path.join(chrome_app_res_dir, 'locale_settings_linux.grd'), | 146 os.path.join(chrome_app_res_dir, 'locale_settings_linux.grd'), |
| 149 os.path.join(chrome_app_res_dir, 'locale_settings_mac.grd'), | 147 os.path.join(chrome_app_res_dir, 'locale_settings_mac.grd'), |
| 150 os.path.join(chrome_app_res_dir, 'locale_settings_win.grd'), | 148 os.path.join(chrome_app_res_dir, 'locale_settings_win.grd'), |
| 151 os.path.join(chrome_app_dir, 'theme', 'theme_resources.grd'), | 149 os.path.join(chrome_app_dir, 'theme', 'theme_resources.grd'), |
| 152 os.path.join(chrome_dir, 'browser', 'browser_resources.grd'), | 150 os.path.join(chrome_dir, 'browser', 'browser_resources.grd'), |
| 153 os.path.join(chrome_dir, 'common', 'common_resources.grd'), | 151 os.path.join(chrome_dir, 'common', 'common_resources.grd'), |
| 154 os.path.join(chrome_dir, 'renderer', 'resources', | 152 os.path.join(chrome_dir, 'renderer', 'resources', |
| 155 'renderer_resources.grd'), | 153 'renderer_resources.grd'), |
| 156 os.path.join(device_base_dir, 'bluetooth', 'bluetooth_strings.grd'), | 154 os.path.join(device_base_dir, 'bluetooth', 'bluetooth_strings.grd'), |
| 157 os.path.join(src_dir, 'extensions', 'extensions_strings.grd'), | 155 os.path.join(src_dir, 'extensions', 'extensions_strings.grd'), |
| 158 os.path.join(src_dir, 'ui', 'resources', 'ui_resources.grd'), | 156 os.path.join(src_dir, 'ui', 'resources', 'ui_resources.grd'), |
| 159 os.path.join(src_dir, 'ui', 'webui', 'resources', 'webui_resources.grd'), | 157 os.path.join(src_dir, 'ui', 'webui', 'resources', 'webui_resources.grd'), |
| 160 os.path.join(ui_strings_dir, 'app_locale_settings.grd'), | 158 os.path.join(ui_strings_dir, 'app_locale_settings.grd'), |
| 161 os.path.join(ui_strings_dir, 'ui_strings.grd'), | 159 os.path.join(ui_strings_dir, 'ui_strings.grd'), |
| 162 os.path.join(ui_chromeos_dir, 'ui_chromeos_strings.grd'), | 160 os.path.join(ui_chromeos_dir, 'ui_chromeos_strings.grd'), |
| 163 ] | 161 ] |
| 164 | 162 |
| 165 # If no source directories were given, default them: | 163 # If no source directories were given, default them: |
| 166 if len(src_dirs) == 0: | 164 if len(src_dirs) == 0: |
| 167 src_dirs = [ | 165 src_dirs = [ |
| 168 os.path.join(src_dir, 'app'), | 166 os.path.join(src_dir, 'app'), |
| 169 os.path.join(src_dir, 'ash'), | 167 os.path.join(src_dir, 'ash'), |
| 170 os.path.join(src_dir, 'athena'), | |
| 171 os.path.join(src_dir, 'chrome'), | 168 os.path.join(src_dir, 'chrome'), |
| 172 os.path.join(src_dir, 'components'), | 169 os.path.join(src_dir, 'components'), |
| 173 os.path.join(src_dir, 'content'), | 170 os.path.join(src_dir, 'content'), |
| 174 os.path.join(src_dir, 'device'), | 171 os.path.join(src_dir, 'device'), |
| 175 os.path.join(src_dir, 'extensions'), | 172 os.path.join(src_dir, 'extensions'), |
| 176 os.path.join(src_dir, 'ui'), | 173 os.path.join(src_dir, 'ui'), |
| 177 # nsNSSCertHelper.cpp has a bunch of ids | 174 # nsNSSCertHelper.cpp has a bunch of ids |
| 178 os.path.join(src_dir, 'third_party', 'mozilla_security_manager'), | 175 os.path.join(src_dir, 'third_party', 'mozilla_security_manager'), |
| 179 os.path.join(chrome_dir, 'installer'), | 176 os.path.join(chrome_dir, 'installer'), |
| 180 ] | 177 ] |
| 181 | 178 |
| 182 return CheckForUnusedGrdIDsInSources(grd_files, src_dirs) | 179 return CheckForUnusedGrdIDsInSources(grd_files, src_dirs) |
| 183 | 180 |
| 184 | 181 |
| 185 if __name__ == '__main__': | 182 if __name__ == '__main__': |
| 186 sys.exit(main()) | 183 sys.exit(main()) |
| OLD | NEW |