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

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

Issue 13058003: Convert native strip from rule to action (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@libraryloader
Patch Set: Created 7 years, 9 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
« no previous file with comments | « no previous file | build/java_apk.gypi » ('j') | build/java_apk.gypi » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 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 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import json
7 import optparse 8 import optparse
8 import os 9 import os
9 import subprocess 10 import subprocess
10 import sys 11 import sys
11 12
12 from pylib import build_utils 13 from pylib import build_utils
13 14
14 15
15 def StripLibrary(android_strip, android_strip_args, library_path, output_path): 16 def StripLibrary(android_strip, android_strip_args, library_path, output_path):
16 strip_cmd = ([android_strip] + 17 strip_cmd = ([android_strip] +
17 android_strip_args + 18 android_strip_args +
18 ['-o', output_path, library_path]) 19 ['-o', output_path, library_path])
19 subprocess.check_call(strip_cmd) 20 subprocess.check_call(strip_cmd)
20 21
21 22
22 def main(argv): 23 def main(argv):
23 parser = optparse.OptionParser() 24 parser = optparse.OptionParser()
24 25
25 parser.add_option('--android-strip', 26 parser.add_option('--android-strip',
26 help='Path to the toolchain\'s strip binary') 27 help='Path to the toolchain\'s strip binary')
27 parser.add_option('--android-strip-arg', action='append', 28 parser.add_option('--android-strip-arg', action='append',
28 help='Argument to be passed to strip') 29 help='Argument to be passed to strip')
30 parser.add_option('--libraries-dir',
31 help='Directory for un-stripped libraries')
29 parser.add_option('--stripped-libraries-dir', 32 parser.add_option('--stripped-libraries-dir',
30 help='Directory for stripped libraries') 33 help='Directory for stripped libraries')
34 parser.add_option('--libraries-file',
35 help='Path to json file containing list of libraries')
36 parser.add_option('--stamp', help='Path to touch on success')
31 37
32 options, paths = parser.parse_args() 38
39 options, _ = parser.parse_args()
40
41 with open(options.libraries_file, 'r') as libfile:
42 libraries = json.load(libfile)
33 43
34 build_utils.MakeDirectory(options.stripped_libraries_dir) 44 build_utils.MakeDirectory(options.stripped_libraries_dir)
35 45
36 for library_path in paths: 46 for library in libraries:
37 stripped_library_path = os.path.join(options.stripped_libraries_dir, 47 library_path = os.path.join(options.libraries_dir, library)
38 os.path.basename(library_path)) 48 stripped_library_path = os.path.join(
49 options.stripped_libraries_dir, library)
39 StripLibrary(options.android_strip, options.android_strip_arg, library_path, 50 StripLibrary(options.android_strip, options.android_strip_arg, library_path,
40 stripped_library_path) 51 stripped_library_path)
41 52
53 if options.stamp:
54 build_utils.Touch(options.stamp)
55
42 56
43 if __name__ == '__main__': 57 if __name__ == '__main__':
44 sys.exit(main(sys.argv)) 58 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | build/java_apk.gypi » ('j') | build/java_apk.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698