Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mach: android install/run: infer adb path from SDK dir #20421

Merged
merged 1 commit into from Jun 19, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -626,6 +626,13 @@ def android_build_dir(self, dev):
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"
@@ -391,6 +391,7 @@ def package(self, release=False, dev=False, android=None, debug=False, debugger=
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 @@ def install(self, release=False, dev=False, android=False, target=None):

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 @@ def install(self, release=False, dev=False, android=False, target=None):
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',
@@ -93,7 +93,7 @@ def run(self, params, release=False, dev=False, android=None, debug=False, debug
"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()

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.