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 '''The 'grit build' tool along with integration for this tool with the | 6 '''The 'grit build' tool along with integration for this tool with the |
7 SCons build system. | 7 SCons build system. |
8 ''' | 8 ''' |
9 | 9 |
10 import filecmp | 10 import filecmp |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 for output in self.res.GetOutputFiles(): | 221 for output in self.res.GetOutputFiles(): |
222 self.VerboseOut('Creating %s...' % output.GetFilename()) | 222 self.VerboseOut('Creating %s...' % output.GetFilename()) |
223 | 223 |
224 # Microsoft's RC compiler can only deal with single-byte or double-byte | 224 # Microsoft's RC compiler can only deal with single-byte or double-byte |
225 # files (no UTF-8), so we make all RC files UTF-16 to support all | 225 # files (no UTF-8), so we make all RC files UTF-16 to support all |
226 # character sets. | 226 # character sets. |
227 if output.GetType() in ('rc_header', 'resource_map_header', | 227 if output.GetType() in ('rc_header', 'resource_map_header', |
228 'resource_map_source', 'resource_file_map_source'): | 228 'resource_map_source', 'resource_file_map_source'): |
229 encoding = 'cp1252' | 229 encoding = 'cp1252' |
230 elif output.GetType() in ('android', 'c_format', 'js_map_format', 'plist', | 230 elif output.GetType() in ('android', 'c_format', 'js_map_format', 'plist', |
231 'plist_strings', 'doc', 'json', | 231 'plist_strings', 'doc', 'json'): |
232 'chrome_messages_json'): | |
233 encoding = 'utf_8' | 232 encoding = 'utf_8' |
| 233 elif output.GetType() in ('chrome_messages_json'): |
| 234 # Chrome Web Store currently expects BOM for UTF-8 files :-( |
| 235 encoding = 'utf-8-sig' |
234 else: | 236 else: |
235 # TODO(gfeher) modify here to set utf-8 encoding for admx/adml | 237 # TODO(gfeher) modify here to set utf-8 encoding for admx/adml |
236 encoding = 'utf_16' | 238 encoding = 'utf_16' |
237 | 239 |
238 # Set the context, for conditional inclusion of resources | 240 # Set the context, for conditional inclusion of resources |
239 self.res.SetOutputLanguage(output.GetLanguage()) | 241 self.res.SetOutputLanguage(output.GetLanguage()) |
240 self.res.SetOutputContext(output.GetContext()) | 242 self.res.SetOutputContext(output.GetContext()) |
241 self.res.SetDefines(self.defines) | 243 self.res.SetDefines(self.defines) |
242 | 244 |
243 # Make the output directory if it doesn't exist. | 245 # Make the output directory if it doesn't exist. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 # Print out any fallback warnings, and missing translation errors, and | 289 # Print out any fallback warnings, and missing translation errors, and |
288 # exit with an error code if there are missing translations in a non-pseudo | 290 # exit with an error code if there are missing translations in a non-pseudo |
289 # and non-official build. | 291 # and non-official build. |
290 warnings = (self.res.UberClique().MissingTranslationsReport(). | 292 warnings = (self.res.UberClique().MissingTranslationsReport(). |
291 encode('ascii', 'replace')) | 293 encode('ascii', 'replace')) |
292 if warnings: | 294 if warnings: |
293 self.VerboseOut(warnings) | 295 self.VerboseOut(warnings) |
294 if self.res.UberClique().HasMissingTranslations(): | 296 if self.res.UberClique().HasMissingTranslations(): |
295 print self.res.UberClique().missing_translations_ | 297 print self.res.UberClique().missing_translations_ |
296 sys.exit(-1) | 298 sys.exit(-1) |
OLD | NEW |