OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 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 dependency ordered list of native libraries. | 7 """Writes dependency ordered list of native libraries. |
8 | 8 |
9 The list excludes any Android system libraries, as those are not bundled with | 9 The list excludes any Android system libraries, as those are not bundled with |
10 the APK. | 10 the APK. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 FullLibraryPath(library_or_executable)] | 66 FullLibraryPath(library_or_executable)] |
67 return build_utils.CheckOutput(readelf_cmd) | 67 return build_utils.CheckOutput(readelf_cmd) |
68 | 68 |
69 | 69 |
70 def GetDependencies(library_or_executable): | 70 def GetDependencies(library_or_executable): |
71 elf = CallReadElf(library_or_executable) | 71 elf = CallReadElf(library_or_executable) |
72 return set(_library_re.findall(elf)) | 72 return set(_library_re.findall(elf)) |
73 | 73 |
74 | 74 |
75 def GetNonSystemDependencies(library_name): | 75 def GetNonSystemDependencies(library_name): |
76 all_deps = GetDependencies(FullLibraryPath(library_name)) | 76 all_deps = GetDependencies(library_name) |
77 return set((lib for lib in all_deps if not IsSystemLibrary(lib))) | 77 return set((lib for lib in all_deps if not IsSystemLibrary(lib))) |
78 | 78 |
79 | 79 |
80 def GetSortedTransitiveDependencies(libraries): | 80 def GetSortedTransitiveDependencies(libraries): |
81 """Returns all transitive library dependencies in dependency order.""" | 81 """Returns all transitive library dependencies in dependency order.""" |
82 return build_utils.GetSortedTransitiveDependencies( | 82 return build_utils.GetSortedTransitiveDependencies( |
83 libraries, GetNonSystemDependencies) | 83 libraries, GetNonSystemDependencies) |
84 | 84 |
85 | 85 |
86 def GetSortedTransitiveDependenciesForBinaries(binaries): | 86 def GetSortedTransitiveDependenciesForBinaries(binaries): |
(...skipping 25 matching lines...) Expand all Loading... |
112 SetLibraryDirs(options.libraries_dir.split(',')) | 112 SetLibraryDirs(options.libraries_dir.split(',')) |
113 | 113 |
114 libraries = build_utils.ParseGypList(options.input_libraries) | 114 libraries = build_utils.ParseGypList(options.input_libraries) |
115 if len(libraries): | 115 if len(libraries): |
116 libraries = GetSortedTransitiveDependenciesForBinaries(libraries) | 116 libraries = GetSortedTransitiveDependenciesForBinaries(libraries) |
117 | 117 |
118 # Convert to "base" library names: e.g. libfoo.so -> foo | 118 # Convert to "base" library names: e.g. libfoo.so -> foo |
119 java_libraries_list = ( | 119 java_libraries_list = ( |
120 '{%s}' % ','.join(['"%s"' % s[3:-3] for s in libraries])) | 120 '{%s}' % ','.join(['"%s"' % s[3:-3] for s in libraries])) |
121 | 121 |
| 122 out_json = { |
| 123 'libraries': libraries, |
| 124 'lib_paths': [FullLibraryPath(l) for l in libraries], |
| 125 'java_libraries_list': java_libraries_list |
| 126 } |
122 build_utils.WriteJson( | 127 build_utils.WriteJson( |
123 {'libraries': libraries, 'java_libraries_list': java_libraries_list}, | 128 out_json, |
124 options.output, | 129 options.output, |
125 only_if_changed=True) | 130 only_if_changed=True) |
126 | 131 |
127 if options.stamp: | 132 if options.stamp: |
128 build_utils.Touch(options.stamp) | 133 build_utils.Touch(options.stamp) |
129 | 134 |
130 if options.depfile: | 135 if options.depfile: |
131 build_utils.WriteDepfile( | 136 build_utils.WriteDepfile( |
132 options.depfile, | 137 options.depfile, |
133 libraries + build_utils.GetPythonDependencies()) | 138 libraries + build_utils.GetPythonDependencies()) |
134 | 139 |
135 | 140 |
136 if __name__ == '__main__': | 141 if __name__ == '__main__': |
137 sys.exit(main()) | 142 sys.exit(main()) |
138 | 143 |
139 | 144 |
OLD | NEW |