| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Writes a build_config file. | 7 """Writes a build_config file. |
| 8 | 8 |
| 9 The build_config file for a target is a json file containing information about | 9 The build_config file for a target is a json file containing information about |
| 10 how to build that target based on the target's dependencies. This includes | 10 how to build that target based on the target's dependencies. This includes |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 config['apk_dex'] = {} | 162 config['apk_dex'] = {} |
| 163 dex_config = config['apk_dex'] | 163 dex_config = config['apk_dex'] |
| 164 # TODO(cjhopman): proguard version | 164 # TODO(cjhopman): proguard version |
| 165 dex_deps_files = [c['dex_path'] for c in all_library_deps] | 165 dex_deps_files = [c['dex_path'] for c in all_library_deps] |
| 166 dex_config['dependency_dex_files'] = dex_deps_files | 166 dex_config['dependency_dex_files'] = dex_deps_files |
| 167 | 167 |
| 168 library_paths = [] | 168 library_paths = [] |
| 169 java_libraries_list = [] | 169 java_libraries_list = [] |
| 170 if options.native_libs: | 170 if options.native_libs: |
| 171 libraries = build_utils.ParseGypList(options.native_libs) | 171 libraries = build_utils.ParseGypList(options.native_libs) |
| 172 libraries_dir = os.path.dirname(libraries[0]) | 172 if libraries: |
| 173 write_ordered_libraries.SetReadelfPath(options.readelf_path) | 173 libraries_dir = os.path.dirname(libraries[0]) |
| 174 write_ordered_libraries.SetLibraryDirs([libraries_dir]) | 174 write_ordered_libraries.SetReadelfPath(options.readelf_path) |
| 175 all_native_library_deps = ( | 175 write_ordered_libraries.SetLibraryDirs([libraries_dir]) |
| 176 write_ordered_libraries.GetSortedTransitiveDependenciesForBinaries( | 176 all_native_library_deps = ( |
| 177 libraries)) | 177 write_ordered_libraries.GetSortedTransitiveDependenciesForBinaries( |
| 178 java_libraries_list = '{%s}' % ','.join( | 178 libraries)) |
| 179 ['"%s"' % s for s in all_native_library_deps]) | 179 # Create a java literal array with the "base" library names: |
| 180 library_paths = map( | 180 # e.g. libfoo.so -> foo |
| 181 write_ordered_libraries.FullLibraryPath, all_native_library_deps) | 181 java_libraries_list = '{%s}' % ','.join( |
| 182 ['"%s"' % s[3:-3] for s in all_native_library_deps]) |
| 183 library_paths = map( |
| 184 write_ordered_libraries.FullLibraryPath, all_native_library_deps) |
| 182 | 185 |
| 183 config['native'] = { | 186 config['native'] = { |
| 184 'libraries': library_paths, | 187 'libraries': library_paths, |
| 185 'java_libraries_list': java_libraries_list | 188 'java_libraries_list': java_libraries_list |
| 186 } | 189 } |
| 187 | 190 |
| 188 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 191 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
| 189 | 192 |
| 190 if options.depfile: | 193 if options.depfile: |
| 191 build_utils.WriteDepfile( | 194 build_utils.WriteDepfile( |
| 192 options.depfile, | 195 options.depfile, |
| 193 all_deps_config_paths + build_utils.GetPythonDependencies()) | 196 all_deps_config_paths + build_utils.GetPythonDependencies()) |
| 194 | 197 |
| 195 | 198 |
| 196 if __name__ == '__main__': | 199 if __name__ == '__main__': |
| 197 sys.exit(main(sys.argv[1:])) | 200 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |