Commit 84a6a5f0 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

mojo: Use resource_map_source instead of resource_file_map_source.

resource_map_source generates a map looking like

  { "IDR_FOO", IDR_FOO }

while resource_file_map_source generations a map looking like

  { "path/to/resource", IDR_FOO }

The latter currently doesn't work for files that contain variable references
in their name (e.g. ${root_gen_dir}).

The mojo code just needs any unique string identifier, so just use
resource_map_source instead.

No intended behavior change.

Bug: 899437
Change-Id: Ifc72086bd3b26997fb29d7d43306ba790a2c4e73
Reviewed-on: https://chromium-review.googlesource.com/c/1307937Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603965}
parent 2cb0574f
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<output filename="grit/mojo_bindings_resources_map.h" <output filename="grit/mojo_bindings_resources_map.h"
type="gzipped_resource_map_header" /> type="gzipped_resource_map_header" />
<output filename="grit/mojo_bindings_resources_map.cc" <output filename="grit/mojo_bindings_resources_map.cc"
type="gzipped_resource_file_map_source" /> type="gzipped_resource_map_source" />
<output filename="mojo_bindings_resources.pak" type="data_package" /> <output filename="mojo_bindings_resources.pak" type="data_package" />
</outputs> </outputs>
<translations /> <translations />
......
...@@ -16,14 +16,16 @@ from grit import util ...@@ -16,14 +16,16 @@ from grit import util
def GetFormatter(type): def GetFormatter(type):
if type == 'resource_map_header': if type == 'resource_map_header':
return _FormatHeader return _FormatHeader
if type == 'resource_map_source':
return partial(_FormatSource, _GetItemName)
if type == 'resource_file_map_source': if type == 'resource_file_map_source':
return partial(_FormatSource, _GetItemPath) return partial(_FormatSource, _GetItemPath)
if type == 'resource_map_source':
return partial(_FormatSource, _GetItemName)
if type == 'gzipped_resource_map_header': if type == 'gzipped_resource_map_header':
return partial(_FormatHeader, include_gzipped=True) return partial(_FormatHeader, include_gzipped=True)
if type == 'gzipped_resource_file_map_source': if type == 'gzipped_resource_file_map_source':
return partial(_FormatSource, _GetItemPath, include_gzipped=True) return partial(_FormatSource, _GetItemPath, include_gzipped=True)
if type == 'gzipped_resource_map_source':
return partial(_FormatSource, _GetItemName, include_gzipped=True)
def GetMapName(root): def GetMapName(root):
......
...@@ -34,6 +34,7 @@ _format_modules = { ...@@ -34,6 +34,7 @@ _format_modules = {
'data_package': 'data_pack', 'data_package': 'data_pack',
'gzipped_resource_file_map_source': 'resource_map', 'gzipped_resource_file_map_source': 'resource_map',
'gzipped_resource_map_header': 'resource_map', 'gzipped_resource_map_header': 'resource_map',
'gzipped_resource_map_source': 'resource_map',
'js_map_format': 'js_map_format', 'js_map_format': 'js_map_format',
'policy_templates': 'policy_templates_json', 'policy_templates': 'policy_templates_json',
'rc_all': 'rc', 'rc_all': 'rc',
...@@ -332,10 +333,12 @@ are exported to translation interchange files (e.g. XMB files), etc. ...@@ -332,10 +333,12 @@ are exported to translation interchange files (e.g. XMB files), etc.
# Microsoft's RC compiler can only deal with single-byte or double-byte # Microsoft's RC compiler can only deal with single-byte or double-byte
# files (no UTF-8), so we make all RC files UTF-16 to support all # files (no UTF-8), so we make all RC files UTF-16 to support all
# character sets. # character sets.
if output_type in ('rc_header', 'resource_map_header', if output_type in ('rc_header', 'resource_file_map_source',
'resource_map_source', 'resource_file_map_source', 'resource_map_header', 'resource_map_source',
'gzipped_resource_file_map_source',
'gzipped_resource_map_header', 'gzipped_resource_map_header',
'gzipped_resource_file_map_source'): 'gzipped_resource_map_source',
):
return 'cp1252' return 'cp1252'
if output_type in ('android', 'c_format', 'js_map_format', 'plist', if output_type in ('android', 'c_format', 'js_map_format', 'plist',
'plist_strings', 'doc', 'json', 'android_policy', 'plist_strings', 'doc', 'json', 'android_policy',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment