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

Unified Diff: build/android/gyp/generate_v14_compatible_resources.py

Issue 15907024: [Android] Skip generating v14 resources if already a version is specified. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6b848082adc544605f1bb88269aa9c59229e0296 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_level_qualifier_index = -1
+ api_level_qualifier = ''
+ for index, qualifier in enumerate(qualifiers):
+ if re.match('v[0-9]+$', qualifier):
+ api_level_qualifier_index = index
+ api_level_qualifier = qualifier
+ break
+
# Android pre-v17 API doesn't support RTL. Skip.
if 'ldrtl' in qualifiers:
continue
@@ -254,19 +263,19 @@ def main(argv):
# We only convert layout resources under layout*/, xml*/,
# and style resources under values*/.
- # TODO(kkimlabs): don't process xml directly once all layouts have
- # 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_level_qualifier:
+ GenerateV14LayoutResourcesInDir(input_dir, output_v14_dir,
+ output_v17_dir)
elif resource_type == 'values':
- if 'v17' in qualifiers:
+ if api_level_qualifier == 'v17':
output_qualifiers = qualifiers[:]
- del output_qualifiers[qualifiers.index('v17')]
+ del output_qualifiers[api_level_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_level_qualifier:
ErrorIfStyleResourceExistsInDir(input_dir)
if options.stamp:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698