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

Side by Side Diff: chrome/tools/build/repack_locales.py

Issue 461773002: Do not build device/bluetooth strings when extensions are disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_resources.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Helper script to repack paks for a list of locales. 6 """Helper script to repack paks for a list of locales.
7 7
8 Gyp doesn't have any built-in looping capability, so this just provides a way to 8 Gyp doesn't have any built-in looping capability, so this just provides a way to
9 loop over a list of locales when repacking pak files, thus avoiding a 9 loop over a list of locales when repacking pak files, thus avoiding a
10 proliferation of mostly duplicate, cut-n-paste gyp actions. 10 proliferation of mostly duplicate, cut-n-paste gyp actions.
(...skipping 16 matching lines...) Expand all
27 INT_DIR = None 27 INT_DIR = None
28 28
29 # The target platform. If it is not defined, sys.platform will be used. 29 # The target platform. If it is not defined, sys.platform will be used.
30 OS = None 30 OS = None
31 31
32 # Note that OS is normally set to 'linux' when building for chromeos. 32 # Note that OS is normally set to 'linux' when building for chromeos.
33 CHROMEOS = False 33 CHROMEOS = False
34 34
35 USE_ASH = False 35 USE_ASH = False
36 ENABLE_AUTOFILL_DIALOG = False 36 ENABLE_AUTOFILL_DIALOG = False
37 ENABLE_EXTENSIONS = False
37 38
38 WHITELIST = None 39 WHITELIST = None
39 40
40 # Extra input files. 41 # Extra input files.
41 EXTRA_INPUT_FILES = [] 42 EXTRA_INPUT_FILES = []
42 43
43 class Usage(Exception): 44 class Usage(Exception):
44 def __init__(self, msg): 45 def __init__(self, msg):
45 self.msg = msg 46 self.msg = msg
46 47
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 if OS != 'ios': 95 if OS != 'ios':
95 #e.g. 96 #e.g.
96 # '<(SHARED_INTERMEDIATE_DIR)/content/app/strings/content_strings_da.pak' 97 # '<(SHARED_INTERMEDIATE_DIR)/content/app/strings/content_strings_da.pak'
97 inputs.append(os.path.join(SHARE_INT_DIR, 'content', 'app', 'strings', 98 inputs.append(os.path.join(SHARE_INT_DIR, 'content', 'app', 'strings',
98 'content_strings_%s.pak' % locale)) 99 'content_strings_%s.pak' % locale))
99 100
100 #e.g. '<(SHARED_INTERMEDIATE_DIR)/ui/strings/ui_strings_da.pak', 101 #e.g. '<(SHARED_INTERMEDIATE_DIR)/ui/strings/ui_strings_da.pak',
101 inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'strings', 102 inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'strings',
102 'ui_strings_%s.pak' % locale)) 103 'ui_strings_%s.pak' % locale))
103 104
105 #e.g. '<(SHARED_INTERMEDIATE_DIR)/ui/strings/app_locale_settings_da.pak',
miket_OOO 2014/08/11 23:35:32 I'm not sure why this moved, but it seems to be a
Lei Zhang 2014/08/11 23:37:55 It's just the way the diff came out when I moved b
106 inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'strings',
107 'app_locale_settings_%s.pak' % locale))
108
109 if ENABLE_AUTOFILL_DIALOG and OS != 'ios' and OS != 'android':
110 #e.g. '<(SHARED_INTERMEDIATE_DIR)/third_party/libaddressinput/
111 # address_input_strings_da.pak',
112 inputs.append(os.path.join(SHARE_INT_DIR, 'third_party', 'libaddressinput',
113 'address_input_strings_%s.pak' % locale))
114
115 if ENABLE_EXTENSIONS:
104 #e.g. '<(SHARED_INTERMEDIATE_DIR)/device/bluetooth/strings/ 116 #e.g. '<(SHARED_INTERMEDIATE_DIR)/device/bluetooth/strings/
105 # device_bluetooth_strings_da.pak', 117 # device_bluetooth_strings_da.pak',
106 inputs.append(os.path.join(SHARE_INT_DIR, 'device', 'bluetooth', 'strings', 118 inputs.append(os.path.join(SHARE_INT_DIR, 'device', 'bluetooth', 'strings',
107 'device_bluetooth_strings_%s.pak' % locale)) 119 'device_bluetooth_strings_%s.pak' % locale))
108 120
109 #e.g. '<(SHARED_INTERMEDIATE_DIR)/ui/strings/app_locale_settings_da.pak',
110 inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'strings',
111 'app_locale_settings_%s.pak' % locale))
112
113 # For example: 121 # For example:
114 # '<(SHARED_INTERMEDIATE_DIR)/extensions/strings/extensions_strings_da.pak 122 # '<(SHARED_INTERMEDIATE_DIR)/extensions/strings/extensions_strings_da.pak
115 # TODO(jamescook): When Android stops building extensions code move this 123 # TODO(jamescook): When Android stops building extensions code move this
116 # to the OS != 'ios' and OS != 'android' section below. 124 # to the OS != 'ios' and OS != 'android' section below.
117 inputs.append(os.path.join(SHARE_INT_DIR, 'extensions', 'strings', 125 inputs.append(os.path.join(SHARE_INT_DIR, 'extensions', 'strings',
118 'extensions_strings_%s.pak' % locale)) 126 'extensions_strings_%s.pak' % locale))
119 127
120 if ENABLE_AUTOFILL_DIALOG and OS != 'ios' and OS != 'android':
121 #e.g. '<(SHARED_INTERMEDIATE_DIR)/third_party/libaddressinput/
122 # address_input_strings_da.pak',
123 inputs.append(os.path.join(SHARE_INT_DIR, 'third_party', 'libaddressinput',
124 'address_input_strings_%s.pak' % locale))
125
126 #e.g. '<(grit_out_dir)/google_chrome_strings_da.pak' 128 #e.g. '<(grit_out_dir)/google_chrome_strings_da.pak'
127 # or 129 # or
128 # '<(grit_out_dir)/chromium_strings_da.pak' 130 # '<(grit_out_dir)/chromium_strings_da.pak'
129 inputs.append(os.path.join( 131 inputs.append(os.path.join(
130 GRIT_DIR, '%s_strings_%s.pak' % (BRANDING, locale))) 132 GRIT_DIR, '%s_strings_%s.pak' % (BRANDING, locale)))
131 133
132 # Add any extra input files. 134 # Add any extra input files.
133 for extra_file in EXTRA_INPUT_FILES: 135 for extra_file in EXTRA_INPUT_FILES:
134 inputs.append('%s_%s.pak' % (extra_file, locale)) 136 inputs.append('%s_%s.pak' % (extra_file, locale))
135 137
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 def DoMain(argv): 178 def DoMain(argv):
177 global BRANDING 179 global BRANDING
178 global GRIT_DIR 180 global GRIT_DIR
179 global SHARE_INT_DIR 181 global SHARE_INT_DIR
180 global INT_DIR 182 global INT_DIR
181 global OS 183 global OS
182 global CHROMEOS 184 global CHROMEOS
183 global USE_ASH 185 global USE_ASH
184 global WHITELIST 186 global WHITELIST
185 global ENABLE_AUTOFILL_DIALOG 187 global ENABLE_AUTOFILL_DIALOG
188 global ENABLE_EXTENSIONS
186 global EXTRA_INPUT_FILES 189 global EXTRA_INPUT_FILES
187 190
188 parser = optparse.OptionParser("usage: %prog [options] locales") 191 parser = optparse.OptionParser("usage: %prog [options] locales")
189 parser.add_option("-i", action="store_true", dest="inputs", default=False, 192 parser.add_option("-i", action="store_true", dest="inputs", default=False,
190 help="Print the expected input file list, then exit.") 193 help="Print the expected input file list, then exit.")
191 parser.add_option("-o", action="store_true", dest="outputs", default=False, 194 parser.add_option("-o", action="store_true", dest="outputs", default=False,
192 help="Print the expected output file list, then exit.") 195 help="Print the expected output file list, then exit.")
193 parser.add_option("-g", action="store", dest="grit_dir", 196 parser.add_option("-g", action="store", dest="grit_dir",
194 help="GRIT build files output directory.") 197 help="GRIT build files output directory.")
195 parser.add_option("-x", action="store", dest="int_dir", 198 parser.add_option("-x", action="store", dest="int_dir",
196 help="Intermediate build files output directory.") 199 help="Intermediate build files output directory.")
197 parser.add_option("-s", action="store", dest="share_int_dir", 200 parser.add_option("-s", action="store", dest="share_int_dir",
198 help="Shared intermediate build files output directory.") 201 help="Shared intermediate build files output directory.")
199 parser.add_option("-b", action="store", dest="branding", 202 parser.add_option("-b", action="store", dest="branding",
200 help="Branding type of this build.") 203 help="Branding type of this build.")
201 parser.add_option("-e", action="append", dest="extra_input", default=[], 204 parser.add_option("-e", action="append", dest="extra_input", default=[],
202 help="Full path to an extra input pak file without the\ 205 help="Full path to an extra input pak file without the\
203 locale suffix and \".pak\" extension.") 206 locale suffix and \".pak\" extension.")
204 parser.add_option("-p", action="store", dest="os", 207 parser.add_option("-p", action="store", dest="os",
205 help="The target OS. (e.g. mac, linux, win, etc.)") 208 help="The target OS. (e.g. mac, linux, win, etc.)")
206 parser.add_option("--use-ash", action="store", dest="use_ash", 209 parser.add_option("--use-ash", action="store", dest="use_ash",
207 help="Whether to include ash strings") 210 help="Whether to include ash strings")
208 parser.add_option("--chromeos", action="store", 211 parser.add_option("--chromeos", action="store",
209 help="Whether building for Chrome OS") 212 help="Whether building for Chrome OS")
210 parser.add_option("--whitelist", action="store", help="Full path to the " 213 parser.add_option("--whitelist", action="store", help="Full path to the "
211 "whitelist used to filter output pak file resource IDs") 214 "whitelist used to filter output pak file resource IDs")
212 parser.add_option("--enable-autofill-dialog", action="store", 215 parser.add_option("--enable-autofill-dialog", action="store",
213 dest="enable_autofill_dialog", 216 dest="enable_autofill_dialog",
214 help="Whether to include strings for autofill dialog") 217 help="Whether to include strings for autofill dialog")
218 parser.add_option("--enable-extensions", action="store",
219 dest="enable_extensions",
220 help="Whether to include strings for extensions")
215 options, locales = parser.parse_args(argv) 221 options, locales = parser.parse_args(argv)
216 222
217 if not locales: 223 if not locales:
218 parser.error('Please specificy at least one locale to process.\n') 224 parser.error('Please specificy at least one locale to process.\n')
219 225
220 print_inputs = options.inputs 226 print_inputs = options.inputs
221 print_outputs = options.outputs 227 print_outputs = options.outputs
222 GRIT_DIR = options.grit_dir 228 GRIT_DIR = options.grit_dir
223 INT_DIR = options.int_dir 229 INT_DIR = options.int_dir
224 SHARE_INT_DIR = options.share_int_dir 230 SHARE_INT_DIR = options.share_int_dir
225 BRANDING = options.branding 231 BRANDING = options.branding
226 EXTRA_INPUT_FILES = options.extra_input 232 EXTRA_INPUT_FILES = options.extra_input
227 OS = options.os 233 OS = options.os
228 CHROMEOS = options.chromeos == '1' 234 CHROMEOS = options.chromeos == '1'
229 USE_ASH = options.use_ash == '1' 235 USE_ASH = options.use_ash == '1'
230 WHITELIST = options.whitelist 236 WHITELIST = options.whitelist
231 ENABLE_AUTOFILL_DIALOG = options.enable_autofill_dialog == '1' 237 ENABLE_AUTOFILL_DIALOG = options.enable_autofill_dialog == '1'
238 ENABLE_EXTENSIONS = options.enable_extensions == '1'
232 239
233 if not OS: 240 if not OS:
234 if sys.platform == 'darwin': 241 if sys.platform == 'darwin':
235 OS = 'mac' 242 OS = 'mac'
236 elif sys.platform.startswith('linux'): 243 elif sys.platform.startswith('linux'):
237 OS = 'linux' 244 OS = 'linux'
238 elif sys.platform in ('cygwin', 'win32'): 245 elif sys.platform in ('cygwin', 'win32'):
239 OS = 'win' 246 OS = 'win'
240 else: 247 else:
241 OS = sys.platform 248 OS = sys.platform
(...skipping 11 matching lines...) Expand all
253 260
254 if print_outputs: 261 if print_outputs:
255 return list_outputs(locales) 262 return list_outputs(locales)
256 263
257 return repack_locales(locales) 264 return repack_locales(locales)
258 265
259 if __name__ == '__main__': 266 if __name__ == '__main__':
260 results = DoMain(sys.argv[1:]) 267 results = DoMain(sys.argv[1:])
261 if results: 268 if results:
262 print results 269 print results
OLDNEW
« no previous file with comments | « chrome/chrome_resources.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698