Index: grit/format/resource_map.py |
diff --git a/grit/format/resource_map.py b/grit/format/resource_map.py |
index 90370aa20eb09b0e894294172cadd90a824a6575..b5a7b453855ab5e57c210fb0628f7574c65936da 100644 |
--- a/grit/format/resource_map.py |
+++ b/grit/format/resource_map.py |
@@ -104,17 +104,23 @@ const size_t %(map_name)sSize = arraysize(%(map_name)s); |
def _FormatSource(get_key, root, lang, output_dir): |
from grit.format import rc_header |
- from grit.node import include, structure |
+ from grit.node import include, structure, message |
yield _FormatSourceHeader(root) |
tids = rc_header.GetIds(root) |
seen = set() |
+ active_descendants = [item for item in root.ActiveDescendants()] |
for item in root: |
- if isinstance(item, (include.IncludeNode, structure.StructureNode)): |
+ 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) |
- yield ' {"%s", %s},\n' % (key, tid) |
+ # For messages, only include the active ones |
+ if not isinstance(item, message.MessageNode) \ |
+ or item in active_descendants: |
+ yield ' {"%s", %s},\n' % (key, tid) |
yield _FormatSourceFooter(root) |