| 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 340d23f15f8cdc5873baf3f22d8c6210fa515e29..736f9a6f48d999d675e7812e72e3e8c5dc099658 100755
|
| --- a/build/android/gyp/write_build_config.py
|
| +++ b/build/android/gyp/write_build_config.py
|
| @@ -129,6 +129,11 @@ def main(argv):
|
| help='Java package name for these resources.')
|
| parser.add_option('--android-manifest', help='Path to android manifest.')
|
|
|
| + # android_assets options
|
| + parser.add_option('--assets', help='List of asset\'s sources.')
|
| + parser.add_option('--disable-asset-compression', action='store_true',
|
| + help='Whether to enable asset compression.')
|
| +
|
| # java library options
|
| parser.add_option('--jar-path', help='Path to target\'s jar output.')
|
| parser.add_option('--supports-android', action='store_true',
|
| @@ -154,18 +159,17 @@ def main(argv):
|
| if args:
|
| parser.error('No positional arguments should be given.')
|
|
|
| -
|
| - if not options.type in [
|
| - 'java_library', 'android_resources', 'android_apk', 'deps_dex']:
|
| + required_options_map = {
|
| + 'java_library': ['build_config', 'jar_path'],
|
| + 'android_assets': ['build_config', 'assets'],
|
| + 'android_resources': ['build_config', 'resources_zip'],
|
| + 'android_apk': ['build_config', 'jar_path', 'dex_path', 'resources_zip'],
|
| + 'deps_dex': ['build_config', 'dex_path']
|
| + }
|
| + required_options = required_options_map.get(options.type)
|
| + if not required_options:
|
| raise Exception('Unknown type: <%s>' % options.type)
|
|
|
| - required_options = ['build_config'] + {
|
| - 'java_library': ['jar_path'],
|
| - 'android_resources': ['resources_zip'],
|
| - 'android_apk': ['jar_path', 'dex_path', 'resources_zip'],
|
| - 'deps_dex': ['dex_path']
|
| - }[options.type]
|
| -
|
| if options.native_libs:
|
| required_options.append('readelf_path')
|
|
|
| @@ -182,8 +186,8 @@ def main(argv):
|
| possible_deps_config_paths = build_utils.ParseGypList(
|
| options.possible_deps_configs)
|
|
|
| - allow_unknown_deps = (options.type == 'android_apk' or
|
| - options.type == 'android_resources')
|
| + allow_unknown_deps = (options.type in
|
| + ('android_apk', 'android_assets', 'android_resources'))
|
| unknown_deps = [
|
| c for c in possible_deps_config_paths if not os.path.exists(c)]
|
| if unknown_deps and not allow_unknown_deps:
|
| @@ -262,6 +266,12 @@ def main(argv):
|
| # Apks will get their resources srcjar explicitly passed to the java step.
|
| config['javac']['srcjars'] = []
|
|
|
| + if options.type == 'android_assets':
|
| + deps_info['assets'] = {
|
| + 'paths': build_utils.ParseGypList(options.assets),
|
| + 'enable_compression': not options.disable_asset_compression
|
| + }
|
| +
|
| if options.type == 'android_resources':
|
| deps_info['resources_zip'] = options.resources_zip
|
| if options.srcjar:
|
| @@ -358,6 +368,8 @@ def main(argv):
|
| 'libraries': library_paths,
|
| 'java_libraries_list': java_libraries_list_holder[0],
|
| }
|
| + all_assets = deps.All('android_assets')
|
| + config['merged_assets'] = [a['assets'] for a in all_assets if 'assets' in a]
|
|
|
| build_utils.WriteJson(config, options.build_config, only_if_changed=True)
|
|
|
|
|