OLD | NEW |
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 """Creates symlinks to native libraries for an APK. | 7 """Creates symlinks to native libraries for an APK. |
8 | 8 |
9 The native libraries should have previously been pushed to the device (in | 9 The native libraries should have previously been pushed to the device (in |
10 options.target_dir). This script then creates links in an apk's lib/ folder to | 10 options.target_dir). This script then creates links in an apk's lib/ folder to |
11 those native libraries. | 11 those native libraries. |
12 """ | 12 """ |
13 | 13 |
| 14 import json |
14 import optparse | 15 import optparse |
15 import os | 16 import os |
16 import sys | 17 import sys |
17 | 18 |
18 # pylint: disable=F0401 | |
19 from util import build_device | 19 from util import build_device |
20 from util import build_utils | 20 from util import build_utils |
21 # pylint: enable=F0401 | 21 from util import md5_check |
22 | 22 |
23 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') | 23 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') |
24 sys.path.append(BUILD_ANDROID_DIR) | 24 sys.path.append(BUILD_ANDROID_DIR) |
25 | 25 |
26 from pylib import constants | 26 from pylib import constants |
27 from pylib.utils import apk_helper | 27 from pylib.utils import apk_helper |
28 | 28 |
29 def RunShellCommand(device, cmd): | 29 def RunShellCommand(device, cmd): |
30 output = device.RunShellCommand(cmd) | 30 output = device.RunShellCommand(cmd) |
31 | 31 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 'STRIPPED_LIBRARIES_DIR=%(target_dir)s; ' | 73 'STRIPPED_LIBRARIES_DIR=%(target_dir)s; ' |
74 '. %(script_device_path)s' | 74 '. %(script_device_path)s' |
75 ) % { | 75 ) % { |
76 'apk_libraries_dir': apk_libraries_dir, | 76 'apk_libraries_dir': apk_libraries_dir, |
77 'target_dir': options.target_dir, | 77 'target_dir': options.target_dir, |
78 'script_device_path': options.script_device_path | 78 'script_device_path': options.script_device_path |
79 } | 79 } |
80 RunShellCommand(device, trigger_cmd) | 80 RunShellCommand(device, trigger_cmd) |
81 | 81 |
82 | 82 |
83 def main(): | 83 def main(argv): |
84 parser = optparse.OptionParser() | 84 parser = optparse.OptionParser() |
85 parser.add_option('--apk', help='Path to the apk.') | 85 parser.add_option('--apk', help='Path to the apk.') |
86 parser.add_option('--script-host-path', | 86 parser.add_option('--script-host-path', |
87 help='Path on the host for the symlink script.') | 87 help='Path on the host for the symlink script.') |
88 parser.add_option('--script-device-path', | 88 parser.add_option('--script-device-path', |
89 help='Path on the device to push the created symlink script.') | 89 help='Path on the device to push the created symlink script.') |
90 parser.add_option('--libraries-json', | 90 parser.add_option('--libraries-json', |
91 help='Path to the json list of native libraries.') | 91 help='Path to the json list of native libraries.') |
92 parser.add_option('--target-dir', | 92 parser.add_option('--target-dir', |
93 help='Device directory that contains the target libraries for symlinks.') | 93 help='Device directory that contains the target libraries for symlinks.') |
(...skipping 10 matching lines...) Expand all Loading... |
104 constants.SetBuildType(options.configuration_name) | 104 constants.SetBuildType(options.configuration_name) |
105 | 105 |
106 CreateSymlinkScript(options) | 106 CreateSymlinkScript(options) |
107 TriggerSymlinkScript(options) | 107 TriggerSymlinkScript(options) |
108 | 108 |
109 if options.stamp: | 109 if options.stamp: |
110 build_utils.Touch(options.stamp) | 110 build_utils.Touch(options.stamp) |
111 | 111 |
112 | 112 |
113 if __name__ == '__main__': | 113 if __name__ == '__main__': |
114 sys.exit(main()) | 114 sys.exit(main(sys.argv)) |
OLD | NEW |