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

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

Issue 14322004: [Android] Fix forwarder for the component build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: change distribution folder to fowarder_dist to avoid colliding with forwarder (1) Created 7 years, 8 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/strip_library_for_device.py ('k') | build/android/native_app_dependencies.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/write_ordered_libraries.py
diff --git a/build/android/gyp/write_ordered_libraries.py b/build/android/gyp/write_ordered_libraries.py
index 338090f0554038a14ba72e76b853a355d2d50011..5bd6e6c21005703e967b8740f7cec0f65d148528 100755
--- a/build/android/gyp/write_ordered_libraries.py
+++ b/build/android/gyp/write_ordered_libraries.py
@@ -28,15 +28,13 @@ import sys
from util import build_utils
-
_options = None
-_libraries_dir = None
_library_re = re.compile(
'.*NEEDED.*Shared library: \[(?P<library_name>[\w/.]+)\]')
def FullLibraryPath(library_name):
- return '%s/%s' % (_libraries_dir, library_name)
+ return '%s/%s' % (_options.libraries_dir, library_name)
def IsSystemLibrary(library_name):
@@ -45,20 +43,20 @@ def IsSystemLibrary(library_name):
return not os.path.exists(FullLibraryPath(library_name))
-def CallReadElf(library_name):
+def CallReadElf(library_or_executable):
readelf_cmd = [_options.readelf,
'-d',
- FullLibraryPath(library_name)]
+ library_or_executable]
return build_utils.CheckCallDie(readelf_cmd, suppress_output=True)
-def GetDependencies(library_name):
- elf = CallReadElf(library_name)
+def GetDependencies(library_or_executable):
+ elf = CallReadElf(library_or_executable)
return set(_library_re.findall(elf))
def GetNonSystemDependencies(library_name):
- all_deps = GetDependencies(library_name)
+ all_deps = GetDependencies(FullLibraryPath(library_name))
return set((lib for lib in all_deps if not IsSystemLibrary(lib)))
@@ -87,12 +85,20 @@ def GetSortedTransitiveDependencies(libraries):
return sorted_deps
+def GetSortedTransitiveDependenciesForExecutable(executable):
+ """Returns all transitive library dependencies in dependency order."""
+ all_deps = GetDependencies(executable)
+ libraries = [lib for lib in all_deps if not IsSystemLibrary(lib)]
+ return GetSortedTransitiveDependencies(libraries)
+
def main(argv):
parser = optparse.OptionParser()
parser.add_option('--input-libraries',
help='A list of top-level input libraries.')
+ parser.add_option('--libraries-dir',
+ help='The directory which contains shared libraries.')
parser.add_option('--readelf', help='Path to the readelf binary.')
parser.add_option('--output', help='Path to the generated .json file.')
parser.add_option('--stamp', help='Path to touch on success.')
@@ -101,11 +107,11 @@ def main(argv):
_options, _ = parser.parse_args()
libraries = build_utils.ParseGypList(_options.input_libraries)
- global _libraries_dir
- _libraries_dir = os.path.dirname(libraries[0])
- libraries = [os.path.basename(lib) for lib in libraries]
-
- libraries = GetSortedTransitiveDependencies(libraries)
+ if libraries[0].endswith('.so'):
+ libraries = [os.path.basename(lib) for lib in libraries]
+ libraries = GetSortedTransitiveDependencies(libraries)
+ else:
+ libraries = GetSortedTransitiveDependenciesForExecutable(libraries[0])
with open(_options.output, 'w') as outfile:
json.dump(libraries, outfile)
« no previous file with comments | « build/android/gyp/strip_library_for_device.py ('k') | build/android/native_app_dependencies.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698