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

Side by Side Diff: build/android/gyp/strip_library_for_device.py

Issue 1647353002: Use gn_helpers to [se]serialize GN lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@python_impl
Patch Set: more Created 4 years, 4 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 | « build/android/gyp/push_libraries.py ('k') | build/android/gyp/util/build_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import optparse
8 import os
9 import sys
10
11 from util import build_utils
12
13
14 def StripLibrary(android_strip, android_strip_args, library_path, output_path):
15 if build_utils.IsTimeStale(output_path, [library_path]):
16 strip_cmd = ([android_strip] +
17 android_strip_args +
18 ['-o', output_path, library_path])
19 build_utils.CheckOutput(strip_cmd)
20
21
22 def main(args):
23 args = build_utils.ExpandFileArgs(args)
24
25 parser = optparse.OptionParser()
26 build_utils.AddDepfileOption(parser)
27
28 parser.add_option('--android-strip',
29 help='Path to the toolchain\'s strip binary')
30 parser.add_option('--android-strip-arg', action='append',
31 help='Argument to be passed to strip')
32 parser.add_option('--libraries-dir',
33 help='Directory for un-stripped libraries')
34 parser.add_option('--stripped-libraries-dir',
35 help='Directory for stripped libraries')
36 parser.add_option('--libraries',
37 help='List of libraries to strip')
38 parser.add_option('--stamp', help='Path to touch on success')
39
40 options, _ = parser.parse_args(args)
41
42 libraries = build_utils.ParseGypList(options.libraries)
43
44 build_utils.MakeDirectory(options.stripped_libraries_dir)
45
46 for library in libraries:
47 for base_path in options.libraries_dir.split(','):
48 library_path = os.path.join(base_path, library)
49 if (os.path.exists(library_path)):
50 break
51 stripped_library_path = os.path.join(
52 options.stripped_libraries_dir, library)
53 StripLibrary(options.android_strip, options.android_strip_arg, library_path,
54 stripped_library_path)
55
56 if options.stamp:
57 build_utils.Touch(options.stamp)
58
59
60 if __name__ == '__main__':
61 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « build/android/gyp/push_libraries.py ('k') | build/android/gyp/util/build_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698