| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Brings in Chrome Android's android_commands module, which itself is a | 5 """Brings in Chrome Android's android_commands module, which itself is a |
| 6 thin(ish) wrapper around adb.""" | 6 thin(ish) wrapper around adb.""" |
| 7 | 7 |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import shutil | 10 import shutil |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 """Some of the android pylib scripts we depend on are lame and expect | 106 """Some of the android pylib scripts we depend on are lame and expect |
| 107 binaries to be in the out/ directory. So we copy any prebuilt binaries there | 107 binaries to be in the out/ directory. So we copy any prebuilt binaries there |
| 108 as a prereq.""" | 108 as a prereq.""" |
| 109 | 109 |
| 110 # TODO(bulach): Build the targets for x86/mips. | 110 # TODO(bulach): Build the targets for x86/mips. |
| 111 device_tools = [ | 111 device_tools = [ |
| 112 'file_poller', | 112 'file_poller', |
| 113 'forwarder_dist/device_forwarder', | 113 'forwarder_dist/device_forwarder', |
| 114 'md5sum_dist/md5sum_bin', | 114 'md5sum_dist/md5sum_bin', |
| 115 'purge_ashmem', | 115 'purge_ashmem', |
| 116 'run_pie', |
| 116 ] | 117 ] |
| 117 | 118 |
| 118 host_tools = [ | 119 host_tools = [ |
| 119 'bitmaptools', | 120 'bitmaptools', |
| 120 'host_forwarder', | 121 'host_forwarder', |
| 121 'md5sum_bin_host', | 122 'md5sum_bin_host', |
| 122 ] | 123 ] |
| 123 | 124 |
| 124 has_device_prebuilt = adb.system_properties['ro.product.cpu.abi'].startswith( | 125 has_device_prebuilt = adb.system_properties['ro.product.cpu.abi'].startswith( |
| 125 'armeabi') | 126 'armeabi') |
| 126 if not has_device_prebuilt: | 127 if not has_device_prebuilt: |
| 127 return all([support_binaries.FindLocallyBuiltPath(t) for t in device_tools]) | 128 return all([support_binaries.FindLocallyBuiltPath(t) for t in device_tools]) |
| 128 | 129 |
| 129 build_type = None | 130 build_type = None |
| 130 for t in device_tools + host_tools: | 131 for t in device_tools + host_tools: |
| 131 executable = os.path.basename(t) | 132 executable = os.path.basename(t) |
| 132 locally_built_path = support_binaries.FindLocallyBuiltPath(t) | 133 locally_built_path = support_binaries.FindLocallyBuiltPath(t) |
| 133 if not build_type: | 134 if not build_type: |
| 134 build_type = GetBuildTypeOfPath(locally_built_path) or 'Release' | 135 build_type = GetBuildTypeOfPath(locally_built_path) or 'Release' |
| 135 constants.SetBuildType(build_type) | 136 constants.SetBuildType(build_type) |
| 136 dest = os.path.join(constants.GetOutDirectory(), t) | 137 dest = os.path.join(constants.GetOutDirectory(), t) |
| 137 if not locally_built_path: | 138 if not locally_built_path: |
| 138 logging.info('Setting up prebuilt %s', dest) | 139 logging.info('Setting up prebuilt %s', dest) |
| 139 if not os.path.exists(os.path.dirname(dest)): | 140 if not os.path.exists(os.path.dirname(dest)): |
| 140 os.makedirs(os.path.dirname(dest)) | 141 os.makedirs(os.path.dirname(dest)) |
| 141 platform_name = ('android' if t in device_tools else | 142 platform_name = ('android' if t in device_tools else |
| 142 platform.GetHostPlatform().GetOSName()) | 143 platform.GetHostPlatform().GetOSName()) |
| 143 prebuilt_path = support_binaries.FindPath(executable, platform_name) | 144 prebuilt_path = support_binaries.FindPath(executable, platform_name) |
| 144 if not os.path.exists(prebuilt_path): | 145 if not prebuilt_path or not os.path.exists(prebuilt_path): |
| 145 raise NotImplementedError(""" | 146 raise NotImplementedError(""" |
| 146 %s must be checked into cloud storage. | 147 %s must be checked into cloud storage. |
| 147 Instructions: | 148 Instructions: |
| 148 http://www.chromium.org/developers/telemetry/upload_to_cloud_storage | 149 http://www.chromium.org/developers/telemetry/upload_to_cloud_storage |
| 149 """ % t) | 150 """ % t) |
| 150 shutil.copyfile(prebuilt_path, dest) | 151 shutil.copyfile(prebuilt_path, dest) |
| 151 os.chmod(dest, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) | 152 os.chmod(dest, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) |
| 152 return True | 153 return True |
| OLD | NEW |