aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Shu <talklittle@gmail.com>2018-03-24 15:44:57 -0700
committerAndrew Shu <talklittle@gmail.com>2018-03-25 10:40:26 -0700
commita631cb6b475b18e77bd6ca9db7ffe2cd94c3bde7 (patch)
tree220bb4698b316f8e199ad9cce367fd1162104088
parent782d4d4af61b7c9f60dfb494f8a5bfb6407945d2 (diff)
downloadservo-a631cb6b475b18e77bd6ca9db7ffe2cd94c3bde7.tar.gz
servo-a631cb6b475b18e77bd6ca9db7ffe2cd94c3bde7.zip
mach: android install/run: infer adb path from SDK dir
-rw-r--r--python/servo/command_base.py7
-rw-r--r--python/servo/package_commands.py5
-rw-r--r--python/servo/post_build_commands.py2
3 files changed, 11 insertions, 3 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index a200fa05f24..881e454d097 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -626,6 +626,13 @@ class CommandBase(object):
def android_aar_dir(self):
return path.join(self.context.topdir, "target", "android_aar")
+ def android_adb_path(self, env):
+ if "ANDROID_SDK" in env:
+ sdk_adb = path.join(env["ANDROID_SDK"], "platform-tools", "adb")
+ if path.exists(sdk_adb):
+ return sdk_adb
+ return "adb"
+
def handle_android_target(self, target):
if target == "arm-linux-androideabi":
self.config["android"]["platform"] = "android-18"
diff --git a/python/servo/package_commands.py b/python/servo/package_commands.py
index 8fb97e9eb70..b78fa1808e0 100644
--- a/python/servo/package_commands.py
+++ b/python/servo/package_commands.py
@@ -391,6 +391,7 @@ class PackageCommands(CommandBase):
default=None,
help='Install the given target platform')
def install(self, release=False, dev=False, android=False, target=None):
+ env = self.build_env()
if target and android:
print("Please specify either --target or --android.")
sys.exit(1)
@@ -413,7 +414,7 @@ class PackageCommands(CommandBase):
if android:
pkg_path = binary_path + ".apk"
- exec_command = ["adb", "install", "-r", pkg_path]
+ exec_command = [self.android_adb_path(env), "install", "-r", pkg_path]
elif is_windows():
pkg_path = path.join(path.dirname(binary_path), 'msi', 'Servo.msi')
exec_command = ["msiexec", "/i", pkg_path]
@@ -426,7 +427,7 @@ class PackageCommands(CommandBase):
return result
print(" ".join(exec_command))
- return subprocess.call(exec_command, env=self.build_env())
+ return subprocess.call(exec_command, env=env)
@Command('upload-nightly',
description='Upload Servo nightly to S3',
diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py
index 6e8c65ec833..4cca8f80a20 100644
--- a/python/servo/post_build_commands.py
+++ b/python/servo/post_build_commands.py
@@ -93,7 +93,7 @@ class PostBuildCommands(CommandBase):
"am start com.mozilla.servo/com.mozilla.servo.MainActivity",
"exit"
]
- shell = subprocess.Popen(["adb", "shell"], stdin=subprocess.PIPE)
+ shell = subprocess.Popen([self.android_adb_path(env), "shell"], stdin=subprocess.PIPE)
shell.communicate("\n".join(script) + "\n")
return shell.wait()