Chromium Code Reviews| Index: build/android/strip_library_for_apk.py |
| diff --git a/build/android/strip_library_for_apk.py b/build/android/strip_library_for_apk.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..19c9f35ce6af58d3fddba16ffdd6b1a0530b10b9 |
| --- /dev/null |
| +++ b/build/android/strip_library_for_apk.py |
| @@ -0,0 +1,49 @@ |
| +#!/usr/bin/env python |
| +# |
| +# Copyright 2013 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import optparse |
| +import os |
| +import subprocess |
| +import sys |
| + |
| + |
| +def EnsureDirectoryExists(dir_path): |
| + try: |
| + os.makedirs(dir_path) |
| + except OSError: |
| + pass |
| + |
| + |
| +def StripLibrary(android_strip, android_strip_args, library_path, output_path): |
| + strip_cmd = ([android_strip] + |
| + android_strip_args + |
| + [library_path, '-o', output_path]) |
| + subprocess.check_call(strip_cmd) |
| + |
| + |
| +def main(argv): |
| + parser = optparse.OptionParser() |
| + |
| + parser.add_option('--android-strip', action='store') |
| + parser.add_option('--android-strip-arg', action='append') |
| + parser.add_option('--libraries-dir', action='store') |
|
Yaron
2013/02/25 21:22:55
Could you os.path.dirname to get the library path,
cjhopman
2013/03/07 01:57:26
Done.
|
| + parser.add_option('--stripped-libraries-dir', action='store') |
| + parser.add_option('--library-file-name', action='store') |
| + |
| + options, args = parser.parse_args() |
|
Yaron
2013/02/25 21:22:55
s/args/_/
cjhopman
2013/03/07 01:57:26
Done.
|
| + |
| + EnsureDirectoryExists(options.stripped_libraries_dir) |
| + |
| + library_path = os.path.join(options.libraries_dir, options.library_file_name) |
| + stripped_library_path = os.path.join(options.stripped_libraries_dir, |
| + options.library_file_name) |
| + |
| + StripLibrary(options.android_strip, options.android_strip_arg, library_path, |
| + stripped_library_path) |
| + |
| + |
| +if __name__ == '__main__': |
| + sys.exit(main(sys.argv)) |