Chromium Code Reviews| Index: build/android/gyp/generate_v14_compatible_resources.py |
| diff --git a/build/android/gyp/generate_v14_compatible_resources.py b/build/android/gyp/generate_v14_compatible_resources.py |
| index cee06504b814ff74a6cdb5956d886794bd87eaf2..ba69de00bbf2bcf26558f759d8ade378d2cec02e 100755 |
| --- a/build/android/gyp/generate_v14_compatible_resources.py |
| +++ b/build/android/gyp/generate_v14_compatible_resources.py |
| @@ -21,6 +21,7 @@ Please refer to http://crbug.com/235118 for the details. |
| import optparse |
| import os |
| +import re |
| import shutil |
| import sys |
| import xml.dom.minidom as minidom |
| @@ -241,6 +242,14 @@ def main(argv): |
| resource_type = dir_pieces[0] |
| qualifiers = dir_pieces[1:] |
| + api_version_qualifier_index = -1 |
|
newt (away)
2013/06/07 04:24:09
super minor nit: "api_level"
Kibeom Kim (inactive)
2013/06/07 05:07:19
Done.
|
| + api_version_qualifier = '' |
| + for index, qualifier in enumerate(qualifiers): |
| + if re.match('\Av[0-9]+$', qualifier): |
|
newt (away)
2013/06/07 04:24:09
"^" instead of "\A" for familiarity and consistenc
Kibeom Kim (inactive)
2013/06/07 05:07:19
Done.
|
| + api_version_qualifier_index = index |
| + api_version_qualifier = qualifier |
| + break |
| + |
| # Android pre-v17 API doesn't support RTL. Skip. |
| if 'ldrtl' in qualifiers: |
| continue |
| @@ -257,16 +266,18 @@ def main(argv): |
| # TODO(kkimlabs): don't process xml directly once all layouts have |
|
newt (away)
2013/06/07 04:24:09
you can probably remove this TODO, since we decide
Kibeom Kim (inactive)
2013/06/07 05:07:19
Done.
|
| # been moved out of XML directory. see http://crbug.com/238458 |
| if resource_type in ('layout', 'xml'): |
| - GenerateV14LayoutResourcesInDir(input_dir, output_v14_dir, output_v17_dir) |
| + if not api_version_qualifier: |
| + GenerateV14LayoutResourcesInDir(input_dir, output_v14_dir, |
| + output_v17_dir) |
| elif resource_type == 'values': |
| - if 'v17' in qualifiers: |
| + if api_version_qualifier == 'v17': |
| output_qualifiers = qualifiers[:] |
| - del output_qualifiers[qualifiers.index('v17')] |
| + del output_qualifiers[api_version_qualifier_index] |
| output_v14_dir = os.path.join(options.res_v14_compatibility_dir, |
| '-'.join([resource_type] + |
| output_qualifiers)) |
| GenerateV14StyleResourcesInDir(input_dir, output_v14_dir) |
| - else: |
| + elif not api_version_qualifier: |
| ErrorIfStyleResourceExistsInDir(input_dir) |
| if options.stamp: |