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

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

Issue 1435333008: GN: asset_location -> android_assets() for html_viewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaswe Created 5 years, 1 month 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 | « no previous file | build/config/android/internal_rules.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/apkbuilder.py
diff --git a/build/android/gyp/apkbuilder.py b/build/android/gyp/apkbuilder.py
index 1837fd615f04df69d604e6604c48e6f33843d48b..404d4dac9d564c2b8d3f3fa0c613acbe0a6216d3 100755
--- a/build/android/gyp/apkbuilder.py
+++ b/build/android/gyp/apkbuilder.py
@@ -31,6 +31,9 @@ def _ParseArgs(args):
help='GYP-list of files to add as assets in the form '
'"srcPath:zipPath", where ":zipPath" is optional.',
default='[]')
+ parser.add_argument('--write-asset-list',
+ action='store_true',
+ help='Whether to create an assets/assets_list file.')
parser.add_argument('--uncompressed-assets',
help='Same as --assets, except disables compression.',
default='[]')
@@ -110,6 +113,11 @@ def _AddAssets(apk, paths, disable_compression=False):
compress=compress)
+def _CreateAssetsList(paths):
+ """Returns a newline-separated list of asset paths for the given paths."""
+ return '\n'.join(_SplitAssetPath(p)[1] for p in sorted(paths)) + '\n'
+
+
def main(args):
args = build_utils.ExpandFileArgs(args)
options = _ParseArgs(args)
@@ -142,8 +150,14 @@ def main(args):
# with finalize_apk(), which sometimes aligns and uncompresses the
# native libraries.
with zipfile.ZipFile(tmp_apk, 'a', zipfile.ZIP_DEFLATED) as apk:
+ if options.write_asset_list:
+ data = _CreateAssetsList(
+ itertools.chain(options.assets, options.uncompressed_assets))
+ build_utils.AddToZipHermetic(apk, 'assets/assets_list', data=data)
+
_AddAssets(apk, options.assets, disable_compression=False)
_AddAssets(apk, options.uncompressed_assets, disable_compression=True)
+
for path in native_libs:
basename = os.path.basename(path)
apk_path = 'lib/%s/%s' % (options.android_abi, basename)
« no previous file with comments | « no previous file | build/config/android/internal_rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698