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 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 with open(options.script_host_path, 'w') as scriptfile: | 51 with open(options.script_host_path, 'w') as scriptfile: |
52 scriptfile.write(script) | 52 scriptfile.write(script) |
53 | 53 |
54 | 54 |
55 def TriggerSymlinkScript(options): | 55 def TriggerSymlinkScript(options): |
56 apk_package = apk_helper.GetPackageName(options.apk) | 56 apk_package = apk_helper.GetPackageName(options.apk) |
57 apk_libraries_dir = '/data/data/%s/lib' % apk_package | 57 apk_libraries_dir = '/data/data/%s/lib' % apk_package |
58 | 58 |
59 adb = android_commands.AndroidCommands() | 59 adb = android_commands.AndroidCommands() |
60 device_dir = os.path.dirname(options.script_device_path) | 60 device_dir = os.path.dirname(options.script_device_path) |
61 mkdir_cmd = ('if [ ! -e %(dir)s ]; then mkdir %(dir)s; fi ' % | 61 mkdir_cmd = ('if [ ! -e %(dir)s ]; then mkdir -p %(dir)s; fi ' % |
62 { 'dir': device_dir }) | 62 { 'dir': device_dir }) |
63 RunShellCommand(adb, mkdir_cmd) | 63 RunShellCommand(adb, mkdir_cmd) |
64 adb.PushIfNeeded(options.script_host_path, options.script_device_path) | 64 adb.PushIfNeeded(options.script_host_path, options.script_device_path) |
65 | 65 |
66 trigger_cmd = ( | 66 trigger_cmd = ( |
67 'APK_LIBRARIES_DIR=%(apk_libraries_dir)s; ' | 67 'APK_LIBRARIES_DIR=%(apk_libraries_dir)s; ' |
68 'STRIPPED_LIBRARIES_DIR=%(target_dir)s; ' | 68 'STRIPPED_LIBRARIES_DIR=%(target_dir)s; ' |
69 '. %(script_device_path)s' | 69 '. %(script_device_path)s' |
70 ) % { | 70 ) % { |
71 'apk_libraries_dir': apk_libraries_dir, | 71 'apk_libraries_dir': apk_libraries_dir, |
(...skipping 28 matching lines...) Expand all Loading... |
100 | 100 |
101 CreateSymlinkScript(options) | 101 CreateSymlinkScript(options) |
102 TriggerSymlinkScript(options) | 102 TriggerSymlinkScript(options) |
103 | 103 |
104 if options.stamp: | 104 if options.stamp: |
105 build_utils.Touch(options.stamp) | 105 build_utils.Touch(options.stamp) |
106 | 106 |
107 | 107 |
108 if __name__ == '__main__': | 108 if __name__ == '__main__': |
109 sys.exit(main(sys.argv)) | 109 sys.exit(main(sys.argv)) |
OLD | NEW |