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

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

Issue 1319623002: Make building of resource zips and srcjars hermetic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@md5-proguard
Patch Set: rebase Created 5 years, 3 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/gn/zip.py ('k') | build/android/gyp/util/build_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/process_resources.py
diff --git a/build/android/gyp/process_resources.py b/build/android/gyp/process_resources.py
index d227954ae96af22f748c6ab35b16780a5e1fa522..e05e0fdff7255f5a9466909433d419f4c16d8fd8 100755
--- a/build/android/gyp/process_resources.py
+++ b/build/android/gyp/process_resources.py
@@ -16,7 +16,6 @@ import os
import re
import shutil
import sys
-import zipfile
import generate_v14_compatible_resources
@@ -276,12 +275,13 @@ def ZipResources(resource_dirs, zip_path):
for d in resource_dirs:
for root, _, files in os.walk(d):
for f in files:
- archive_path = os.path.join(os.path.relpath(root, d), f)
+ archive_path = f
+ parent_dir = os.path.relpath(root, d)
+ if parent_dir != '.':
+ archive_path = os.path.join(parent_dir, f)
path = os.path.join(root, f)
files_to_zip[archive_path] = path
- with zipfile.ZipFile(zip_path, 'w') as outzip:
- for archive_path, path in files_to_zip.iteritems():
- outzip.write(path, archive_path)
+ build_utils.DoZip(files_to_zip.iteritems(), zip_path)
def CombineZips(zip_files, output_path):
@@ -290,12 +290,10 @@ def CombineZips(zip_files, output_path):
# resources directory. While some resources just clobber others (image files,
# etc), other resources (particularly .xml files) need to be more
# intelligently merged. That merging is left up to aapt.
- with zipfile.ZipFile(output_path, 'w') as outzip:
- for i, z in enumerate(zip_files):
- with zipfile.ZipFile(z, 'r') as inzip:
- for name in inzip.namelist():
- new_name = '%d/%s' % (i, name)
- outzip.writestr(new_name, inzip.read(name))
+ def path_transform(name, src_zip):
+ return '%d/%s' % (zip_files.index(src_zip), name)
+
+ build_utils.MergeZips(output_path, zip_files, path_transform=path_transform)
def main():
« no previous file with comments | « build/android/gn/zip.py ('k') | build/android/gyp/util/build_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698