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

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

Issue 2404253003: Reland #2 of Fix monochrome not booting issue (Closed)
Patch Set: Change default back to loading locales from disk Created 4 years, 2 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 | « build/android/gyp/locale_pak_resources.py ('k') | build/android/resource_sizes.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c17bfcb45906717c585940668da6dae9f34eb147..8f4580eaa6d113fd86683fbd2a8dcdda9aabacf8 100755
--- a/build/android/gyp/write_build_config.py
+++ b/build/android/gyp/write_build_config.py
@@ -209,12 +209,21 @@ def _ExtractSharedLibsFromRuntimeDeps(runtime_deps_files):
ret.reverse()
return ret
+
def _CreateJavaLibrariesList(library_paths):
- """ Create a java literal array with the "base" library names:
+ """Returns a java literal array with the "base" library names:
e.g. libfoo.so -> foo
"""
return ('{%s}' % ','.join(['"%s"' % s[3:-3] for s in library_paths]))
+
+def _CreateLocalePaksAssetJavaList(assets):
+ """Returns a java literal array from a list of assets in the form src:dst."""
+ names_only = (a.split(':')[1][:-4] for a in assets if a.endswith('.pak'))
+ locales_only = (a for a in names_only if '-' in a or len(a) == 2)
+ return '{%s}' % ','.join(sorted('"%s"' % a for a in locales_only))
+
+
def main(argv):
parser = optparse.OptionParser()
build_utils.AddDepfileOption(parser)
@@ -233,8 +242,6 @@ def main(argv):
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')
@@ -290,8 +297,6 @@ def main(argv):
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.')
@@ -339,21 +344,6 @@ def main(argv):
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')
@@ -485,8 +475,6 @@ def main(argv):
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:
@@ -658,6 +646,10 @@ def main(argv):
}
config['assets'], config['uncompressed_assets'] = (
_MergeAssets(deps.All('android_assets')))
+ config['compressed_locales_java_list'] = (
+ _CreateLocalePaksAssetJavaList(config['assets']))
+ config['uncompressed_locales_java_list'] = (
+ _CreateLocalePaksAssetJavaList(config['uncompressed_assets']))
build_utils.WriteJson(config, options.build_config, only_if_changed=True)
« no previous file with comments | « build/android/gyp/locale_pak_resources.py ('k') | build/android/resource_sizes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698