Index: build/android/gyp/write_build_config.py |
diff --git a/build/android/gyp/write_build_config.py b/build/android/gyp/write_build_config.py |
index 3024f9526f63934645a64f31aa4045cad9417443..c17bfcb45906717c585940668da6dae9f34eb147 100755 |
--- a/build/android/gyp/write_build_config.py |
+++ b/build/android/gyp/write_build_config.py |
@@ -233,6 +233,8 @@ |
parser.add_option('--package-name', |
help='Java package name for these resources.') |
parser.add_option('--android-manifest', help='Path to android manifest.') |
+ parser.add_option('--is-locale-resource', action='store_true', |
+ help='Whether it is locale resource.') |
parser.add_option('--resource-dirs', action='append', default=[], |
help='GYP-list of resource dirs') |
@@ -288,6 +290,8 @@ |
help='GYP-list of proguard flag files to use in final apk.') |
parser.add_option('--proguard-info', |
help='Path to the proguard .info output for this apk.') |
+ parser.add_option('--has-alternative-locale-resource', action='store_true', |
+ help='Whether there is alternative-locale-resource in direct deps') |
parser.add_option('--fail', |
help='GYP-list of error message lines to fail with.') |
@@ -335,6 +339,21 @@ |
deps = Deps(direct_deps_config_paths) |
all_inputs = deps.AllConfigPaths() |
+ # Remove other locale resources if there is alternative_locale_resource in |
+ # direct deps. |
+ if options.has_alternative_locale_resource: |
+ alternative = [r['path'] for r in deps.Direct('android_resources') |
+ if r.get('is_locale_resource')] |
+ # We can only have one locale resources in direct deps. |
+ if len(alternative) != 1: |
+ raise Exception('The number of locale resource in direct deps is wrong %d' |
+ % len(alternative)) |
+ unwanted = [r['path'] for r in deps.All('android_resources') |
+ if r.get('is_locale_resource') and r['path'] not in alternative] |
+ for p in unwanted: |
+ deps.RemoveNonDirectDep(p) |
+ |
+ |
direct_library_deps = deps.Direct('java_library') |
all_library_deps = deps.All('java_library') |
@@ -466,6 +485,8 @@ |
deps_info['package_name'] = options.package_name |
if options.r_text: |
deps_info['r_text'] = options.r_text |
+ if options.is_locale_resource: |
+ deps_info['is_locale_resource'] = True |
deps_info['resources_dirs'] = [] |
if options.resource_dirs: |