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 b8363138567c9f01746931b0a384f007e03f3491..04437b6047fd546ad86065d1c99227e3b29b5975 100755 |
--- a/build/android/gyp/write_build_config.py |
+++ b/build/android/gyp/write_build_config.py |
@@ -36,6 +36,9 @@ import sys |
from util import build_utils |
+import write_ordered_libraries |
+ |
+ |
dep_config_cache = {} |
def GetDepConfig(path): |
if not path in dep_config_cache: |
@@ -74,6 +77,10 @@ def main(argv): |
parser.add_option('--jar-path', help='Path to target\'s jar output.') |
parser.add_option('--dex-path', help='Path to target\'s dex output.') |
+ # apk native library options |
+ parser.add_option('--native-libs', help='List of top-level native libs.') |
+ parser.add_option('--readelf-path', help='Path to toolchain\'s readelf.') |
+ |
options, args = parser.parse_args(argv) |
if args: |
@@ -91,14 +98,15 @@ def main(argv): |
'android_apk': ['jar_path', 'dex_path', 'resources_zip'] |
}[options.type] |
+ if options.native_libs: |
+ required_options += ['readelf_path'] |
+ |
build_utils.CheckOptions(options, parser, required_options) |
possible_deps_config_paths = build_utils.ParseGypList( |
options.possible_deps_configs) |
- |
- |
allow_unknown_deps = options.type == 'android_apk' |
unknown_deps = [ |
c for c in possible_deps_config_paths if not os.path.exists(c)] |
@@ -157,6 +165,26 @@ def main(argv): |
dex_deps_files = [c['dex_path'] for c in all_library_deps] |
dex_config['dependency_dex_files'] = dex_deps_files |
+ library_paths = [] |
+ java_libraries_list = [] |
+ if options.native_libs: |
+ libraries = build_utils.ParseGypList(options.native_libs) |
+ libraries_dir = os.path.dirname(libraries[0]) |
+ write_ordered_libraries.SetReadelfPath(options.readelf_path) |
+ write_ordered_libraries.SetLibraryDirs([libraries_dir]) |
+ all_native_library_deps = ( |
+ write_ordered_libraries.GetSortedTransitiveDependenciesForBinaries( |
+ libraries)) |
+ java_libraries_list = '{%s}' % ','.join( |
+ ['"%s"' % s for s in all_native_library_deps]) |
+ library_paths = map( |
+ write_ordered_libraries.FullLibraryPath, all_native_library_deps) |
+ |
+ config['native'] = { |
+ 'libraries': library_paths, |
+ 'java_libraries_list': java_libraries_list |
+ } |
+ |
build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
if options.depfile: |