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