summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 00:33:59 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 00:33:59 +0000
commitd1e6507f69d4b310f0451806e0bcc9afcc4a0bf4 (patch)
tree49e954069ac30a8e7191d311d4d6a01d829e5c75
parent1f445a2e52d2789eccb067daf246b84958c6aaaf (diff)
downloadchromium_src-d1e6507f69d4b310f0451806e0bcc9afcc4a0bf4.zip
chromium_src-d1e6507f69d4b310f0451806e0bcc9afcc4a0bf4.tar.gz
chromium_src-d1e6507f69d4b310f0451806e0bcc9afcc4a0bf4.tar.bz2
Reverting 22418.
TBR=mmoss Review URL: http://codereview.chromium.org/159892 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22449 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/chrome.gyp176
-rwxr-xr-xchrome/tools/build/repack_locales.py179
2 files changed, 142 insertions, 213 deletions
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index f53b26b..422bfda 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -22,17 +22,6 @@
'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome',
'mac_xib_localizer_tool_path': '<(DEPTH)/build/mac/generate_localizer',
'mac_xib_localizers_dir': '<(INTERMEDIATE_DIR)/xib_localizers',
- # TODO(mmoss) This might need to go somewhere more general, then we can use
- # it to also rewrite app/locales/locales.gyp with a helper script.
- 'locales': [
- 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
- 'en-US', 'es-419', 'es', 'et', 'fi', 'fil', 'fr', 'gu', 'he',
- 'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv',
- 'ml', 'mr', 'nb', 'nl', 'or', 'pl', 'pt-BR', 'pt-PT', 'ro',
- 'ru', 'sk', 'sl', 'sr', 'sv', 'ta', 'te', 'th', 'tr',
- 'uk', 'vi', 'zh-CN', 'zh-TW',
- ],
- 'repack_locales_cmd': ['python', 'tools/build/repack_locales.py',],
'browser_tests_sources': [
'browser/browser_browsertest.cc',
'browser/crash_recovery_browsertest.cc',
@@ -202,8 +191,6 @@
],
'outputs': [
'<(grit_out_dir)/grit/<(RULE_INPUT_ROOT).h',
- # TODO(mmoss) Generate this list from a helper script, like
- # repack_locales_cmd.
'<(grit_out_dir)/<(RULE_INPUT_ROOT)_da.pak',
'<(grit_out_dir)/<(RULE_INPUT_ROOT)_en-US.pak',
'<(grit_out_dir)/<(RULE_INPUT_ROOT)_he.pak',
@@ -2881,9 +2868,11 @@
},
{
'destination': '<(PRODUCT_DIR)/locales',
- 'files': [
- '>!@(<(repack_locales_cmd) -o -g \'<(grit_out_dir)\' -s \'<(SHARED_INTERMEDIATE_DIR)\' -x \'<(INTERMEDIATE_DIR)\' <(locales))',
- ],
+ 'files': ['<(INTERMEDIATE_DIR)/repack/da.pak',
+ '<(INTERMEDIATE_DIR)/repack/en-US.pak',
+ '<(INTERMEDIATE_DIR)/repack/he.pak',
+ '<(INTERMEDIATE_DIR)/repack/zh-TW.pak',
+ ],
},
{
'destination': '<(PRODUCT_DIR)/themes',
@@ -3230,46 +3219,165 @@
],
},
{
- 'action_name': 'repack_locales',
+ # TODO(mark): Make this work with more languages than the
+ # hardcoded da, en-US, he, zh-TW.
+ 'action_name': 'repack_locale_da',
'variables': {
+ 'pak_inputs': [
+ '<(grit_out_dir)/generated_resources_da.pak',
+ '<(grit_out_dir)/locale_settings_da.pak',
+ '<(SHARED_INTERMEDIATE_DIR)/app/app_strings_da.pak',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_da.pak',
+ ],
'conditions': [
['branding=="Chrome"', {
- 'branding_flag': ['-b', 'google_chrome',],
+ 'pak_inputs': [
+ '<(grit_out_dir)/google_chrome_strings_da.pak',
+ ]
}, { # else: branding!="Chrome"
- 'branding_flag': ['-b', 'chromium',],
+ 'pak_inputs': [
+ '<(grit_out_dir)/chromium_strings_da.pak',
+ ]
}],
],
},
'inputs': [
- 'tools/build/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 <(branding_flag) -g \'<(grit_out_dir)\' -s \'<(SHARED_INTERMEDIATE_DIR)\' -x \'<(INTERMEDIATE_DIR)\' <(locales))',
+ '<(repack_path)',
+ '<@(pak_inputs)',
],
'conditions': [
['OS=="mac"', {
'outputs': [
'<(INTERMEDIATE_DIR)/repack/da.lproj/locale.pak',
+ ],
+ }, { # else: OS!="mac"
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/repack/da.pak',
+ ],
+ }],
+ ],
+ 'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'],
+ },
+ {
+ # TODO(mark): Make this work with more languages than the
+ # hardcoded da, en-US, he, zh-TW.
+ 'action_name': 'repack_locale_en_us',
+ 'variables': {
+ 'pak_inputs': [
+ '<(grit_out_dir)/generated_resources_en-US.pak',
+ '<(grit_out_dir)/locale_settings_en-US.pak',
+ '<(SHARED_INTERMEDIATE_DIR)/app/app_strings_en-US.pak',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.pak',
+ ],
+ 'conditions': [
+ ['branding=="Chrome"', {
+ 'pak_inputs': [
+ '<(grit_out_dir)/google_chrome_strings_en-US.pak',
+ ]
+ }, { # else: branding!="Chrome"
+ 'pak_inputs': [
+ '<(grit_out_dir)/chromium_strings_en-US.pak',
+ ]
+ }],
+ ],
+ },
+ 'inputs': [
+ '<(repack_path)',
+ '<@(pak_inputs)',
+ ],
+ 'conditions': [
+ ['OS=="mac"', {
+ 'outputs': [
'<(INTERMEDIATE_DIR)/repack/en.lproj/locale.pak',
+ ],
+ }, { # else: OS!="mac"
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/repack/en-US.pak',
+ ],
+ }],
+ ],
+ 'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'],
+ 'process_outputs_as_mac_bundle_resources': 1,
+ },
+ {
+ # TODO(mark): Make this work with more languages than the
+ # hardcoded da, en-US, he, zh-TW.
+ 'action_name': 'repack_locale_he',
+ 'variables': {
+ 'pak_inputs': [
+ '<(grit_out_dir)/generated_resources_he.pak',
+ '<(grit_out_dir)/locale_settings_he.pak',
+ '<(SHARED_INTERMEDIATE_DIR)/app/app_strings_he.pak',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_he.pak',
+ ],
+ 'conditions': [
+ ['branding=="Chrome"', {
+ 'pak_inputs': [
+ '<(grit_out_dir)/google_chrome_strings_he.pak',
+ ]
+ }, { # else: branding!="Chrome"
+ 'pak_inputs': [
+ '<(grit_out_dir)/chromium_strings_he.pak',
+ ]
+ }],
+ ],
+ },
+ 'inputs': [
+ '<(repack_path)',
+ '<@(pak_inputs)',
+ ],
+ 'conditions': [
+ ['OS=="mac"', {
+ 'outputs': [
'<(INTERMEDIATE_DIR)/repack/he.lproj/locale.pak',
- '<(INTERMEDIATE_DIR)/repack/zh.lproj/locale.pak',
],
}, { # else: OS!="mac"
'outputs': [
- '>!@(<(repack_locales_cmd) -o -g \'<(grit_out_dir)\' -s \'<(SHARED_INTERMEDIATE_DIR)\' -x \'<(INTERMEDIATE_DIR)\' <(locales))',
+ '<(INTERMEDIATE_DIR)/repack/he.pak',
],
}],
],
- 'action': ['<@(repack_locales_cmd)',
- '<@(branding_flag)',
- '-g', '<(grit_out_dir)',
- '-s', '<(SHARED_INTERMEDIATE_DIR)',
- '-x', '<(INTERMEDIATE_DIR)',
- '<@(locales)',
+ 'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'],
+ },
+ {
+ # TODO(mark): Make this work with more languages than the
+ # hardcoded da, en-US, he, zh-TW.
+ 'action_name': 'repack_locale_zh_tw',
+ 'variables': {
+ 'pak_inputs': [
+ '<(grit_out_dir)/generated_resources_zh-TW.pak',
+ '<(grit_out_dir)/locale_settings_zh-TW.pak',
+ '<(SHARED_INTERMEDIATE_DIR)/app/app_strings_zh-TW.pak',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_zh-TW.pak',
+ ],
+ 'conditions': [
+ ['branding=="Chrome"', {
+ 'pak_inputs': [
+ '<(grit_out_dir)/google_chrome_strings_zh-TW.pak',
+ ]
+ }, { # else: branding!="Chrome"
+ 'pak_inputs': [
+ '<(grit_out_dir)/chromium_strings_zh-TW.pak',
+ ]
+ }],
+ ],
+ },
+ 'inputs': [
+ '<(repack_path)',
+ '<@(pak_inputs)',
],
+ 'conditions': [
+ ['OS=="mac"', {
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/repack/zh.lproj/locale.pak',
+ ],
+ }, { # else: OS!="mac"
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/repack/zh-TW.pak',
+ ],
+ }],
+ ],
+ 'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'],
},
],
'sources!': [
diff --git a/chrome/tools/build/repack_locales.py b/chrome/tools/build/repack_locales.py
deleted file mode 100755
index 8726ade..0000000
--- a/chrome/tools/build/repack_locales.py
+++ /dev/null
@@ -1,179 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2009 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Helper script to repack paks for a list of locales.
-
-Gyp doesn't have any built-in looping capability, so this just provides a way to
-loop over a list of locales when repacking pak files, thus avoiding a
-proliferation of mostly duplicate, cut-n-paste gyp actions.
-"""
-
-import getopt
-import os
-import sys
-
-sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', '..', '..',
- 'tools', 'data_pack'))
-import repack
-
-# The gyp "branding" variable.
-BRANDING = None
-
-# Some build paths defined by gyp.
-GRIT_DIR = None
-SHARE_INT_DIR = None
-INT_DIR = None
-
-
-class Usage(Exception):
- def __init__(self, msg):
- self.msg = msg
-
-
-def calc_output(locale):
- """Determine the file that will be generated for the given locale."""
- #e.g. '<(INTERMEDIATE_DIR)/repack/da.pak',
- return '%s/repack/%s.pak' % (INT_DIR, locale)
-
-
-def calc_inputs(locale):
- """Determine the files that need processing for the given locale."""
- inputs = []
-
- #e.g. '<(grit_out_dir)/generated_resources_da.pak'
- inputs.append('%s/generated_resources_%s.pak' % (GRIT_DIR, locale))
-
- #e.g. '<(grit_out_dir)/locale_settings_da.pak'
- inputs.append('%s/locale_settings_%s.pak' % (GRIT_DIR, locale))
-
- #e.g. '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_da.pak'
- inputs.append('%s/webkit/webkit_strings_%s.pak' % (SHARE_INT_DIR, locale))
-
- #e.g. '<(grit_out_dir)/google_chrome_strings_da.pak'
- # or
- # '<(grit_out_dir)/chromium_strings_da.pak'
- inputs.append('%s/%s_strings_%s.pak' % (GRIT_DIR, BRANDING, locale))
-
- return inputs
-
-
-def list_outputs(locales):
- """Print the names of files that will be generated for the given locales.
-
- This is to provide gyp the list of output files, so build targets can
- properly track what needs to be built.
- """
- outputs = []
- for locale in locales:
- outputs.append(calc_output(locale))
- # Quote each element so filename spaces don't mess up gyp's attempt to parse
- # it into a list.
- print " ".join(['"%s"' % x for x in outputs])
-
-
-def list_inputs(locales):
- """Print the names of files that will be processed for the given locales.
-
- This is to provide gyp the list of input files, so build targets can properly
- track their prerequisites.
- """
- inputs = []
- for locale in locales:
- inputs += calc_inputs(locale)
- # Quote each element so filename spaces don't mess up gyp's attempt to parse
- # it into a list.
- print " ".join(['"%s"' % x for x in inputs])
-
-
-def repack_locales(locales):
- """ Loop over and repack the given locales."""
- for locale in locales:
- inputs = []
- inputs += calc_inputs(locale)
- output = calc_output(locale)
- print 'Repacking %s -> %s' % (inputs, output)
- repack.RePack(output, inputs)
-
-
-def main(argv=None):
- global BRANDING
- global GRIT_DIR
- global SHARE_INT_DIR
- global INT_DIR
-
- if argv is None:
- argv = sys.argv
-
- short_options = 'iog:s:x:b:h'
- long_options = 'help'
-
- print_inputs = False
- print_outputs = False
- usage_msg = ''
-
- helpstr = """\
-Usage: %s [-h] [-i | -o] -g <DIR> -x <DIR> -s <DIR> -b <branding> <locale> [...]
- -h, --help Print this help, then exit.
- -i Print the expected input file list, then exit.
- -o Print the expected output file list, then exit.
- -g DIR GRIT build files output directory.
- -x DIR Intermediate build files output directory.
- -s DIR Shared intermediate build files output directory.
- -b branding Branding type of this build.
- locale [...] One or more locales to repack.""" % (argv[0])
-
- try:
- try:
- opts, locales = getopt.getopt(argv[1:], short_options, long_options)
- except getopt.GetoptError, msg:
- raise Usage(str(msg))
-
- if not locales:
- usage_msg = 'Please specificy at least one locale to process.\n'
-
- for o, a in opts:
- if o in ('-i'):
- print_inputs = True
- elif o in ('-o'):
- print_outputs = True
- elif o in ('-g'):
- GRIT_DIR = a
- elif o in ('-s'):
- SHARE_INT_DIR = a
- elif o in ('-x'):
- INT_DIR = a
- elif o in ('-b'):
- BRANDING = a
- elif o in ('-h', '--help'):
- print helpstr
- return 0
-
- if not (GRIT_DIR and INT_DIR and SHARE_INT_DIR):
- usage_msg += 'Please specify all of "-g" and "-x" and "-s".\n'
- if print_inputs and print_outputs:
- usage_msg += 'Please specify only one of "-i" or "-o".\n'
- # Need to know the branding, unless we're just listing the outputs.
- if not print_outputs and not BRANDING:
- usage_msg += 'Please specify "-b" to determine the input files.\n'
-
- if usage_msg:
- raise Usage(usage_msg)
- except Usage, err:
- sys.stderr.write(err.msg + '\n')
- sys.stderr.write(helpstr + '\n')
- return 2
-
- if print_inputs:
- list_inputs(locales)
- return 0
-
- if print_outputs:
- list_outputs(locales)
- return 0
-
- repack_locales(locales)
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv))