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

Side by Side Diff: build/android/gyp/generate_v14_compatible_resources.py

Issue 362543004: Fix generation of v14 resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | build/java_apk.gypi » ('j') | build/java_apk.gypi » ('J')
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 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Convert Android xml resources to API 14 compatible. 7 """Convert Android xml resources to API 14 compatible.
8 8
9 There are two reasons that we cannot just use API 17 attributes, 9 There are two reasons that we cannot just use API 17 attributes,
10 so we are generating another set of resources by this script. 10 so we are generating another set of resources by this script.
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 if args: 275 if args:
276 parser.error('No positional arguments should be given.') 276 parser.error('No positional arguments should be given.')
277 277
278 # Check that required options have been provided. 278 # Check that required options have been provided.
279 required_options = ('res_dir', 'res_v14_compatibility_dir') 279 required_options = ('res_dir', 'res_v14_compatibility_dir')
280 build_utils.CheckOptions(options, parser, required=required_options) 280 build_utils.CheckOptions(options, parser, required=required_options)
281 return options 281 return options
282 282
283 def GenerateV14Resources(res_dir, res_v14_dir, verify_only): 283 def GenerateV14Resources(res_dir, res_v14_dir, verify_only):
284 build_utils.DeleteDirectory(res_v14_dir)
285 build_utils.MakeDirectory(res_v14_dir)
286
287 for name in os.listdir(res_dir): 284 for name in os.listdir(res_dir):
288 if not os.path.isdir(os.path.join(res_dir, name)): 285 if not os.path.isdir(os.path.join(res_dir, name)):
289 continue 286 continue
290 287
291 dir_pieces = name.split('-') 288 dir_pieces = name.split('-')
292 resource_type = dir_pieces[0] 289 resource_type = dir_pieces[0]
293 qualifiers = dir_pieces[1:] 290 qualifiers = dir_pieces[1:]
294 291
295 api_level_qualifier_index = -1 292 api_level_qualifier_index = -1
296 api_level_qualifier = '' 293 api_level_qualifier = ''
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 output_v14_dir = os.path.join(res_v14_dir, 327 output_v14_dir = os.path.join(res_v14_dir,
331 '-'.join([resource_type] + 328 '-'.join([resource_type] +
332 output_qualifiers)) 329 output_qualifiers))
333 GenerateV14StyleResourcesInDir(input_dir, output_v14_dir) 330 GenerateV14StyleResourcesInDir(input_dir, output_v14_dir)
334 elif not api_level_qualifier: 331 elif not api_level_qualifier:
335 ErrorIfStyleResourceExistsInDir(input_dir) 332 ErrorIfStyleResourceExistsInDir(input_dir)
336 333
337 def main(): 334 def main():
338 options = ParseArgs() 335 options = ParseArgs()
339 336
340 GenerateV14Resources( 337 res_v14_dir = options.res_v14_compatibility_dir
341 options.res_dir, options.res_v14_compatibility_dir, options.verify_only) 338
339 build_utils.DeleteDirectory(res_v14_dir)
340 build_utils.MakeDirectory(res_v14_dir)
341
342 GenerateV14Resources(options.res_dir, res_v14_dir, options.verify_only)
342 343
343 if options.stamp: 344 if options.stamp:
344 build_utils.Touch(options.stamp) 345 build_utils.Touch(options.stamp)
345 346
346 if __name__ == '__main__': 347 if __name__ == '__main__':
347 sys.exit(main()) 348 sys.exit(main())
348 349
OLDNEW
« no previous file with comments | « no previous file | build/java_apk.gypi » ('j') | build/java_apk.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698