| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, |
| 72 'target_dir': options.target_dir, | 72 'target_dir': options.target_dir, |
| 73 'script_device_path': options.script_device_path | 73 'script_device_path': options.script_device_path |
| 74 } | 74 } |
| 75 RunShellCommand(adb, trigger_cmd) | 75 RunShellCommand(adb, trigger_cmd) |
| 76 | 76 |
| 77 | 77 |
| 78 def main(argv): | 78 def main(argv): |
| 79 if not build_utils.IsDeviceReady(): |
| 80 build_utils.PrintBigWarning( |
| 81 'Zero (or multiple) devices attached. Skipping creating symlinks.') |
| 82 return |
| 83 |
| 79 parser = optparse.OptionParser() | 84 parser = optparse.OptionParser() |
| 80 parser.add_option('--apk', help='Path to the apk.') | 85 parser.add_option('--apk', help='Path to the apk.') |
| 81 parser.add_option('--script-host-path', | 86 parser.add_option('--script-host-path', |
| 82 help='Path on the host for the symlink script.') | 87 help='Path on the host for the symlink script.') |
| 83 parser.add_option('--script-device-path', | 88 parser.add_option('--script-device-path', |
| 84 help='Path on the device to push the created symlink script.') | 89 help='Path on the device to push the created symlink script.') |
| 85 parser.add_option('--libraries-json', | 90 parser.add_option('--libraries-json', |
| 86 help='Path to the json list of native libraries.') | 91 help='Path to the json list of native libraries.') |
| 87 parser.add_option('--target-dir', | 92 parser.add_option('--target-dir', |
| 88 help='Device directory that contains the target libraries for symlinks.') | 93 help='Device directory that contains the target libraries for symlinks.') |
| 89 parser.add_option('--stamp', help='Path to touch on success.') | 94 parser.add_option('--stamp', help='Path to touch on success.') |
| 90 options, _ = parser.parse_args() | 95 options, _ = parser.parse_args() |
| 91 | 96 |
| 92 required_options = ['apk', 'libraries_json', 'script_host_path', | 97 required_options = ['apk', 'libraries_json', 'script_host_path', |
| 93 'script_device_path', 'target_dir'] | 98 'script_device_path', 'target_dir'] |
| 94 build_utils.CheckOptions(options, parser, required=required_options) | 99 build_utils.CheckOptions(options, parser, required=required_options) |
| 95 | 100 |
| 96 CreateSymlinkScript(options) | 101 CreateSymlinkScript(options) |
| 97 TriggerSymlinkScript(options) | 102 TriggerSymlinkScript(options) |
| 98 | 103 |
| 99 if options.stamp: | 104 if options.stamp: |
| 100 build_utils.Touch(options.stamp) | 105 build_utils.Touch(options.stamp) |
| 101 | 106 |
| 102 | 107 |
| 103 if __name__ == '__main__': | 108 if __name__ == '__main__': |
| 104 sys.exit(main(sys.argv)) | 109 sys.exit(main(sys.argv)) |
| OLD | NEW |