| 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 optparse | 14 import optparse |
| 15 import os | 15 import os |
| 16 import sys | 16 import sys |
| 17 | 17 |
| 18 from util import build_device | 18 from util import build_device |
| 19 from util import build_utils | 19 from util import build_utils |
| 20 | 20 |
| 21 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') | 21 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') |
| 22 sys.path.append(BUILD_ANDROID_DIR) | 22 sys.path.append(BUILD_ANDROID_DIR) |
| 23 | 23 |
| 24 import devil_chromium |
| 24 from devil.android import apk_helper | 25 from devil.android import apk_helper |
| 25 from pylib import constants | 26 from pylib import constants |
| 26 | 27 |
| 27 def RunShellCommand(device, cmd): | 28 def RunShellCommand(device, cmd): |
| 28 output = device.RunShellCommand(cmd) | 29 output = device.RunShellCommand(cmd) |
| 29 | 30 |
| 30 if output: | 31 if output: |
| 31 raise Exception( | 32 raise Exception( |
| 32 'Unexpected output running command: ' + cmd + '\n' + | 33 'Unexpected output running command: ' + cmd + '\n' + |
| 33 '\n'.join(output)) | 34 '\n'.join(output)) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 help='Path on the device to push the created symlink script.') | 90 help='Path on the device to push the created symlink script.') |
| 90 parser.add_option('--libraries', | 91 parser.add_option('--libraries', |
| 91 help='List of native libraries.') | 92 help='List of native libraries.') |
| 92 parser.add_option('--target-dir', | 93 parser.add_option('--target-dir', |
| 93 help='Device directory that contains the target libraries for symlinks.') | 94 help='Device directory that contains the target libraries for symlinks.') |
| 94 parser.add_option('--stamp', help='Path to touch on success.') | 95 parser.add_option('--stamp', help='Path to touch on success.') |
| 95 parser.add_option('--build-device-configuration', | 96 parser.add_option('--build-device-configuration', |
| 96 help='Path to build device configuration.') | 97 help='Path to build device configuration.') |
| 97 parser.add_option('--configuration-name', | 98 parser.add_option('--configuration-name', |
| 98 help='The build CONFIGURATION_NAME') | 99 help='The build CONFIGURATION_NAME') |
| 100 parser.add_option('--output-directory', |
| 101 help='The output directory') |
| 99 options, _ = parser.parse_args(args) | 102 options, _ = parser.parse_args(args) |
| 100 | 103 |
| 101 required_options = ['apk', 'libraries', 'script_host_path', | 104 required_options = ['apk', 'libraries', 'script_host_path', |
| 102 'script_device_path', 'target_dir', 'configuration_name'] | 105 'script_device_path', 'target_dir', 'configuration_name'] |
| 103 build_utils.CheckOptions(options, parser, required=required_options) | 106 build_utils.CheckOptions(options, parser, required=required_options) |
| 104 constants.SetBuildType(options.configuration_name) | 107 constants.SetBuildType(options.configuration_name) |
| 105 | 108 |
| 109 devil_chromium.Initialize( |
| 110 output_directory=os.path.abspath(options.output_directory)) |
| 111 |
| 106 CreateSymlinkScript(options) | 112 CreateSymlinkScript(options) |
| 107 TriggerSymlinkScript(options) | 113 TriggerSymlinkScript(options) |
| 108 | 114 |
| 109 if options.stamp: | 115 if options.stamp: |
| 110 build_utils.Touch(options.stamp) | 116 build_utils.Touch(options.stamp) |
| 111 | 117 |
| 112 | 118 |
| 113 if __name__ == '__main__': | 119 if __name__ == '__main__': |
| 114 sys.exit(main(sys.argv[1:])) | 120 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |