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

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

Issue 361633002: [Android][gn] Add android resources templates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-java
Patch Set: Fix bad rebase Created 6 years, 5 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/write_build_config.py ('k') | build/config/android/config.gni » ('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 b1e3cec811b4403b2bf0454e7b898192f6dd5421..31aba74ccaf428e133c6167ab24aa2fcd5bafd59 100755
--- a/build/android/gyp/write_ordered_libraries.py
+++ b/build/android/gyp/write_ordered_libraries.py
@@ -65,33 +65,18 @@ def GetNonSystemDependencies(library_name):
def GetSortedTransitiveDependencies(libraries):
"""Returns all transitive library dependencies in dependency order."""
- def GraphNode(library):
- return (library, GetNonSystemDependencies(library))
-
- # First: find all library dependencies.
- unchecked_deps = libraries
- all_deps = set(libraries)
- while unchecked_deps:
- lib = unchecked_deps.pop()
- new_deps = GetNonSystemDependencies(lib).difference(all_deps)
- unchecked_deps.extend(new_deps)
- all_deps = all_deps.union(new_deps)
-
- # Then: simple, slow topological sort.
- sorted_deps = []
- unsorted_deps = dict(map(GraphNode, all_deps))
- while unsorted_deps:
- for library, dependencies in unsorted_deps.items():
- if not dependencies.intersection(unsorted_deps.keys()):
- sorted_deps.append(library)
- del unsorted_deps[library]
-
- 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 build_utils.GetSortedTransitiveDependencies(
+ libraries, GetNonSystemDependencies)
+
+
+def GetSortedTransitiveDependenciesForBinaries(binaries):
+ if binaries[0].endswith('.so'):
+ libraries = [os.path.basename(lib) for lib in binaries]
+ else:
+ assert len(binaries) == 1
+ all_deps = GetDependencies(binaries[0])
+ libraries = [lib for lib in all_deps if not IsSystemLibrary(lib)]
+
return GetSortedTransitiveDependencies(libraries)
@@ -111,11 +96,7 @@ def main():
libraries = build_utils.ParseGypList(_options.input_libraries)
if len(libraries):
- if libraries[0].endswith('.so'):
- libraries = [os.path.basename(lib) for lib in libraries]
- libraries = GetSortedTransitiveDependencies(libraries)
- else:
- libraries = GetSortedTransitiveDependenciesForExecutable(libraries[0])
+ libraries = GetSortedTransitiveDependenciesForBinaries(libraries)
build_utils.WriteJson(libraries, _options.output, only_if_changed=True)
« no previous file with comments | « build/android/gyp/write_build_config.py ('k') | build/config/android/config.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698