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

Side by Side Diff: build/android/create_standalone_apk.py

Issue 17569006: Support using loadable module for libpeerconnection on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: code review Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/android/chrome_with_libs.gyp ('k') | build/android/create_standalone_apk_action.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """Combines stripped libraries and incomplete APK into single standalone APK.
8
9 """
10
11 import optparse
12 import os
13 import shutil
14 import sys
15 import tempfile
16
17 from util import build_utils
18 from util import md5_check
19
20 def CreateStandaloneApk(options):
21 def DoZip():
22 with tempfile.NamedTemporaryFile(suffix='.zip') as intermediate_file:
23 intermediate_path = intermediate_file.name
24 shutil.copy(options.input_apk_path, intermediate_path)
25 apk_path_abs = os.path.abspath(intermediate_path)
26 build_utils.CheckCallDie(
27 ['zip', '-r', '-1', apk_path_abs, 'lib'],
28 cwd=options.libraries_top_dir,
29 suppress_output=True)
30 shutil.copy(intermediate_path, options.output_apk_path)
31
32 input_paths = [options.input_apk_path, options.libraries_top_dir]
33 record_path = '%s.standalone.stamp' % options.input_apk_path
34 md5_check.CallAndRecordIfStale(
35 DoZip,
36 record_path=record_path,
37 input_paths=input_paths)
38
39
40 def main(argv):
41 parser = optparse.OptionParser()
42 parser.add_option('--libraries-top-dir',
43 help='Top directory that contains libraries '
44 '(i.e. library paths are like '
45 'libraries_top_dir/lib/android_app_abi/foo.so).')
46 parser.add_option('--input-apk-path', help='Path to incomplete APK.')
47 parser.add_option('--output-apk-path', help='Path for standalone APK.')
48 parser.add_option('--stamp', help='Path to touch on success.')
49 options, _ = parser.parse_args()
50
51 required_options = ['libraries_top_dir', 'input_apk_path', 'output_apk_path']
52 build_utils.CheckOptions(options, parser, required=required_options)
53
54 CreateStandaloneApk(options)
55
56 if options.stamp:
57 build_utils.Touch(options.stamp)
58
59
60 if __name__ == '__main__':
61 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/chrome_with_libs.gyp ('k') | build/android/create_standalone_apk_action.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698