Fix ninja build generation of locale files (issue #1052).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1372 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
940d2c474d
commit
405ea14138
53
cef.gyp
53
cef.gyp
|
@ -584,70 +584,25 @@
|
||||||
'<(DEPTH)/webkit/webkit_resources.gyp:webkit_strings',
|
'<(DEPTH)/webkit/webkit_resources.gyp:webkit_strings',
|
||||||
'cef_strings',
|
'cef_strings',
|
||||||
],
|
],
|
||||||
'variables': {
|
|
||||||
'repack_locales_cmd': ['python', 'tools/repack_locales.py'],
|
|
||||||
},
|
|
||||||
'copies': [
|
|
||||||
{
|
|
||||||
'destination': '<(PRODUCT_DIR)/locales',
|
|
||||||
'files': [
|
|
||||||
'<!@pymod_do_main(repack_locales -o -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(INTERMEDIATE_DIR) <(locales))'
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'conditions': [
|
|
||||||
['OS=="win"', {
|
|
||||||
'actions': [
|
'actions': [
|
||||||
{
|
{
|
||||||
'action_name': 'repack_locales',
|
'action_name': 'repack_locales',
|
||||||
'inputs': [
|
'inputs': [
|
||||||
'tools/repack_locales.py',
|
'tools/repack_locales.py',
|
||||||
# NOTE: Ideally the common command args would be shared
|
|
||||||
# amongst inputs/outputs/action, but the args include shell
|
|
||||||
# variables which need to be passed intact, and command
|
|
||||||
# expansion wants to expand the shell variables. Adding the
|
|
||||||
# explicit quoting here was the only way it seemed to work.
|
|
||||||
'>!@(<(repack_locales_cmd) -i -g \"<(grit_out_dir)\" -s \"<(SHARED_INTERMEDIATE_DIR)\" -x \"<(INTERMEDIATE_DIR)\" <(locales))',
|
|
||||||
],
|
],
|
||||||
'outputs': [
|
'outputs': [
|
||||||
'>!@(<(repack_locales_cmd) -o -g \"<(grit_out_dir)\" -s \"<(SHARED_INTERMEDIATE_DIR)\" -x \"<(INTERMEDIATE_DIR)\" <(locales))',
|
'<(PRODUCT_DIR)/cef_repack_locales.stamp',
|
||||||
],
|
],
|
||||||
'action': [
|
'action': [
|
||||||
'<@(repack_locales_cmd)',
|
'python',
|
||||||
'-g', '<(grit_out_dir)',
|
|
||||||
'-s', '<(SHARED_INTERMEDIATE_DIR)',
|
|
||||||
'-x', '<(INTERMEDIATE_DIR)',
|
|
||||||
'<@(locales)',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}, { # OS!="win"
|
|
||||||
'actions': [
|
|
||||||
{
|
|
||||||
'action_name': 'repack_locales',
|
|
||||||
'inputs': [
|
|
||||||
'tools/repack_locales.py',
|
'tools/repack_locales.py',
|
||||||
# NOTE: Ideally the common command args would be shared
|
|
||||||
# amongst inputs/outputs/action, but the args include shell
|
|
||||||
# variables which need to be passed intact, and command
|
|
||||||
# expansion wants to expand the shell variables. Adding the
|
|
||||||
# explicit quoting here was the only way it seemed to work.
|
|
||||||
'>!@(<(repack_locales_cmd) -i -g \'<(grit_out_dir)\' -s \'<(SHARED_INTERMEDIATE_DIR)\' -x \'<(INTERMEDIATE_DIR)\' <(locales))',
|
|
||||||
],
|
|
||||||
'outputs': [
|
|
||||||
'>!@(<(repack_locales_cmd) -o -g \'<(grit_out_dir)\' -s \'<(SHARED_INTERMEDIATE_DIR)\' -x \'<(INTERMEDIATE_DIR)\' <(locales))',
|
|
||||||
],
|
|
||||||
'action': [
|
|
||||||
'<@(repack_locales_cmd)',
|
|
||||||
'-g', '<(grit_out_dir)',
|
'-g', '<(grit_out_dir)',
|
||||||
'-s', '<(SHARED_INTERMEDIATE_DIR)',
|
'-s', '<(SHARED_INTERMEDIATE_DIR)',
|
||||||
'-x', '<(INTERMEDIATE_DIR)',
|
'-x', '<(PRODUCT_DIR)/locales',
|
||||||
'<@(locales)',
|
'<@(locales)',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}],
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'target_name': 'about_credits',
|
'target_name': 'about_credits',
|
||||||
|
@ -663,7 +618,7 @@
|
||||||
'<(generator_path)',
|
'<(generator_path)',
|
||||||
],
|
],
|
||||||
'outputs': [
|
'outputs': [
|
||||||
'<(about_credits_file)',
|
'<(PRODUCT_DIR)/cef_generate_about_credits.stamp',
|
||||||
],
|
],
|
||||||
'hard_dependency': 1,
|
'hard_dependency': 1,
|
||||||
'action': ['python',
|
'action': ['python',
|
||||||
|
|
|
@ -29,9 +29,9 @@ class Usage(Exception):
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
|
|
||||||
def calc_output(locale):
|
def calc_output(locale, create_dir):
|
||||||
"""Determine the file that will be generated for the given locale."""
|
"""Determine the file that will be generated for the given locale."""
|
||||||
#e.g. '<(INTERMEDIATE_DIR)/repack/da.pak',
|
#e.g. '<(INTERMEDIATE_DIR)/da.pak',
|
||||||
# For Fake Bidi, generate it at a fixed path so that tests can safely
|
# For Fake Bidi, generate it at a fixed path so that tests can safely
|
||||||
# reference it.
|
# reference it.
|
||||||
if locale == 'fake-bidi':
|
if locale == 'fake-bidi':
|
||||||
|
@ -42,9 +42,12 @@ def calc_output(locale):
|
||||||
# simply as 'en' (http://crbug.com/19165, http://crbug.com/25578).
|
# simply as 'en' (http://crbug.com/19165, http://crbug.com/25578).
|
||||||
if locale == 'en-US':
|
if locale == 'en-US':
|
||||||
locale = 'en'
|
locale = 'en'
|
||||||
return '%s/repack/%s.lproj/locale.pak' % (INT_DIR, locale.replace('-', '_'))
|
dir = '%s/%s.lproj' % (INT_DIR, locale.replace('-', '_'))
|
||||||
|
if create_dir and not os.path.exists(dir):
|
||||||
|
os.makedirs(dir)
|
||||||
|
return dir + '/locale.pak'
|
||||||
else:
|
else:
|
||||||
return os.path.join(INT_DIR, 'repack', locale + '.pak')
|
return os.path.join(INT_DIR, locale + '.pak')
|
||||||
|
|
||||||
|
|
||||||
def calc_inputs(locale):
|
def calc_inputs(locale):
|
||||||
|
@ -88,7 +91,7 @@ def list_outputs(locales):
|
||||||
"""
|
"""
|
||||||
outputs = []
|
outputs = []
|
||||||
for locale in locales:
|
for locale in locales:
|
||||||
outputs.append(calc_output(locale))
|
outputs.append(calc_output(locale, False))
|
||||||
# Quote each element so filename spaces don't mess up gyp's attempt to parse
|
# Quote each element so filename spaces don't mess up gyp's attempt to parse
|
||||||
# it into a list.
|
# it into a list.
|
||||||
return " ".join(['"%s"' % x for x in outputs])
|
return " ".join(['"%s"' % x for x in outputs])
|
||||||
|
@ -113,7 +116,7 @@ def repack_locales(locales):
|
||||||
for locale in locales:
|
for locale in locales:
|
||||||
inputs = []
|
inputs = []
|
||||||
inputs += calc_inputs(locale)
|
inputs += calc_inputs(locale)
|
||||||
output = calc_output(locale)
|
output = calc_output(locale, True)
|
||||||
data_pack.DataPack.RePack(output, inputs)
|
data_pack.DataPack.RePack(output, inputs)
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,6 +179,9 @@ Usage: %s [-h] [-i | -o] -g <DIR> -x <DIR> -s <DIR> <locale> [...]
|
||||||
if print_outputs:
|
if print_outputs:
|
||||||
return list_outputs(locales)
|
return list_outputs(locales)
|
||||||
|
|
||||||
|
if not os.path.exists(INT_DIR):
|
||||||
|
os.makedirs(INT_DIR)
|
||||||
|
|
||||||
return repack_locales(locales)
|
return repack_locales(locales)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue