Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1651)

Unified Diff: grit/format/resource_map.py

Issue 444053003: Respect output_all_resource_defines when generating resource maps. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | grit/format/resource_map_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/format/resource_map.py
===================================================================
--- grit/format/resource_map.py (revision 171)
+++ grit/format/resource_map.py (working copy)
@@ -110,17 +110,25 @@
seen = set()
active_descendants = [item for item in root.ActiveDescendants()]
for item in root:
- if isinstance(item, (include.IncludeNode,
- structure.StructureNode,
- message.MessageNode)):
- key = get_key(item)
- tid = item.attrs['name']
- if tid in tids and key not in seen:
- seen.add(key)
- # For messages, only include the active ones
- if not isinstance(item, message.MessageNode) \
- or item in active_descendants:
- yield ' {"%s", %s},\n' % (key, tid)
+ if not isinstance(item, (include.IncludeNode,
+ structure.StructureNode,
+ message.MessageNode)):
tony 2014/08/06 21:13:31 This code and the isinstance checks below are a li
Lei Zhang 2014/08/06 21:41:08 Done.
+ continue
+ key = get_key(item)
+ tid = item.attrs['name']
+ if tid not in tids or key in seen:
+ continue
+ seen.add(key)
+ should_yield = True
+ if isinstance(item, message.MessageNode):
+ # For messages, only include the active ones.
+ should_yield = item in active_descendants
+ elif isinstance(item, structure.StructureNode):
+ # For structures, it depends...
+ if not root.ShouldOutputAllResourceDefines():
+ should_yield = item in active_descendants
+ if should_yield:
+ yield ' {"%s", %s},\n' % (key, tid)
yield _FormatSourceFooter(root)
« no previous file with comments | « no previous file | grit/format/resource_map_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698