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

Unified Diff: build/android/gyp/util/build_utils.py

Issue 361633002: [Android][gn] Add android resources templates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-java
Patch Set: Created 6 years, 6 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
Index: build/android/gyp/util/build_utils.py
diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py
index 9b74f689d6db875dc132fd92a729165ff3dfbf85..c9d4004bbe24d2726244d4e47b5857621b03add5 100644
--- a/build/android/gyp/util/build_utils.py
+++ b/build/android/gyp/util/build_utils.py
@@ -198,6 +198,8 @@ def ExtractAll(zip_path, path=None, no_clobber=True):
with zipfile.ZipFile(zip_path) as z:
for name in z.namelist():
+ if name.endswith('/'):
+ continue
CheckZipPath(name)
if no_clobber:
output_path = os.path.join(path, name)
@@ -216,6 +218,16 @@ def DoZip(inputs, output, base_dir):
outfile.write(f, os.path.relpath(f, base_dir))
+def ZipDir(output, base_dir):
+ with zipfile.ZipFile(output, 'w') as outfile:
+ for root, _, files in os.walk(base_dir):
+ for f in files:
+ path = os.path.join(root, f)
+ archive_path = os.path.relpath(path, base_dir)
+ CheckZipPath(archive_path)
+ outfile.write(path, archive_path)
+
+
def PrintWarning(message):
print 'WARNING: ' + message
@@ -226,6 +238,31 @@ def PrintBigWarning(message):
print '***** ' * 8
+def GetSortedTransitiveDependencies(top, deps_func):
newt (away) 2014/07/07 21:47:11 What the heck is a deps_func? This function and it
cjhopman 2014/07/08 00:16:27 Done.
+ def Node(dep):
+ return (dep, deps_func(dep))
+
+ # First: find all deps
+ unchecked_deps = list(top)
+ all_deps = set(top)
+ while unchecked_deps:
+ dep = unchecked_deps.pop()
+ new_deps = deps_func(dep).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(Node, 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 GetPythonDependencies():
"""Gets the paths of imported non-system python modules.

Powered by Google App Engine
This is Rietveld 408576698