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 json |
15 import optparse | 15 import optparse |
16 import os | 16 import os |
17 import sys | 17 import sys |
18 | 18 |
| 19 from util import build_utils |
| 20 |
19 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') | 21 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') |
20 sys.path.append(BUILD_ANDROID_DIR) | 22 sys.path.append(BUILD_ANDROID_DIR) |
21 | 23 |
22 from pylib import android_commands | 24 from pylib import android_commands |
23 from pylib import build_utils | |
24 from pylib.utils import apk_helper | 25 from pylib.utils import apk_helper |
25 | 26 |
26 | 27 |
27 def CreateLinks(options): | 28 def CreateLinks(options): |
28 libraries = build_utils.ReadJson(options.libraries_json) | 29 libraries = build_utils.ReadJson(options.libraries_json) |
29 apk_package = apk_helper.GetPackageName(options.apk) | 30 apk_package = apk_helper.GetPackageName(options.apk) |
30 | 31 |
31 # There is a large (~100ms) overhead for each call to adb.RunShellCommand. To | 32 # There is a large (~100ms) overhead for each call to adb.RunShellCommand. To |
32 # avoid this overhead, craft a single command that creates all the links. | 33 # avoid this overhead, craft a single command that creates all the links. |
33 link = '/data/data/' + apk_package + '/lib/$f' | 34 link = '/data/data/' + apk_package + '/lib/$f' |
(...skipping 29 matching lines...) Expand all Loading... |
63 build_utils.CheckOptions(options, parser, required=required_options) | 64 build_utils.CheckOptions(options, parser, required=required_options) |
64 | 65 |
65 CreateLinks(options) | 66 CreateLinks(options) |
66 | 67 |
67 if options.stamp: | 68 if options.stamp: |
68 build_utils.Touch(options.stamp) | 69 build_utils.Touch(options.stamp) |
69 | 70 |
70 | 71 |
71 if __name__ == '__main__': | 72 if __name__ == '__main__': |
72 sys.exit(main(sys.argv)) | 73 sys.exit(main(sys.argv)) |
OLD | NEW |