Index: build/android/gyp/push_libraries.py |
diff --git a/build/android/gyp/push_libraries.py b/build/android/gyp/push_libraries.py |
index b94d6b5ebf800e6c527a9fdff00a9d47722948c4..349e0cbafc621c697be218da546d9b0d079306bc 100755 |
--- a/build/android/gyp/push_libraries.py |
+++ b/build/android/gyp/push_libraries.py |
@@ -13,20 +13,19 @@ import optparse |
import os |
import sys |
+from util import build_device |
from util import build_utils |
from util import md5_check |
-BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), '..') |
-sys.path.append(BUILD_ANDROID_DIR) |
- |
-from pylib import android_commands |
- |
- |
def DoPush(options): |
libraries = build_utils.ReadJson(options.libraries_json) |
- adb = android_commands.AndroidCommands() |
- serial_number = adb.Adb().GetSerialNumber() |
+ device = build_device.GetBuildDeviceFromPath( |
+ options.build_device_configuration) |
+ if not device: |
+ return |
+ |
+ serial_number = device.GetSerialNumber() |
# A list so that it is modifiable in Push below. |
needs_directory = [True] |
for lib in libraries: |
@@ -35,9 +34,9 @@ def DoPush(options): |
def Push(): |
if needs_directory: |
- adb.RunShellCommand('mkdir -p ' + options.device_dir) |
+ device.RunShellCommand('mkdir -p ' + options.device_dir) |
needs_directory[:] = [] # = False |
- adb.PushIfNeeded(host_path, device_path) |
+ device.PushIfNeeded(host_path, device_path) |
record_path = '%s.%s.push.md5.stamp' % (host_path, serial_number) |
md5_check.CallAndRecordIfStale( |
@@ -48,11 +47,6 @@ def DoPush(options): |
def main(argv): |
- if not build_utils.IsDeviceReady(): |
- build_utils.PrintBigWarning( |
- 'Zero (or multiple) devices attached. Skipping native library push.') |
- return |
- |
parser = optparse.OptionParser() |
parser.add_option('--libraries-dir', |
help='Directory that contains stripped libraries.') |
@@ -61,6 +55,8 @@ def main(argv): |
parser.add_option('--libraries-json', |
help='Path to the json list of native libraries.') |
parser.add_option('--stamp', help='Path to touch on success.') |
+ parser.add_option('--build-device-configuration', |
+ help='Path to build device configuration.') |
options, _ = parser.parse_args() |
required_options = ['libraries_dir', 'device_dir', 'libraries_json'] |