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