mirror of
https://github.com/servo/servo.git
synced 2025-07-29 10:10:34 +01:00
mach: android install/run: infer adb path from SDK dir
This commit is contained in:
parent
782d4d4af6
commit
a631cb6b47
3 changed files with 11 additions and 3 deletions
|
@ -626,6 +626,13 @@ class CommandBase(object):
|
||||||
def android_aar_dir(self):
|
def android_aar_dir(self):
|
||||||
return path.join(self.context.topdir, "target", "android_aar")
|
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):
|
def handle_android_target(self, target):
|
||||||
if target == "arm-linux-androideabi":
|
if target == "arm-linux-androideabi":
|
||||||
self.config["android"]["platform"] = "android-18"
|
self.config["android"]["platform"] = "android-18"
|
||||||
|
|
|
@ -391,6 +391,7 @@ class PackageCommands(CommandBase):
|
||||||
default=None,
|
default=None,
|
||||||
help='Install the given target platform')
|
help='Install the given target platform')
|
||||||
def install(self, release=False, dev=False, android=False, target=None):
|
def install(self, release=False, dev=False, android=False, target=None):
|
||||||
|
env = self.build_env()
|
||||||
if target and android:
|
if target and android:
|
||||||
print("Please specify either --target or --android.")
|
print("Please specify either --target or --android.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -413,7 +414,7 @@ class PackageCommands(CommandBase):
|
||||||
|
|
||||||
if android:
|
if android:
|
||||||
pkg_path = binary_path + ".apk"
|
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():
|
elif is_windows():
|
||||||
pkg_path = path.join(path.dirname(binary_path), 'msi', 'Servo.msi')
|
pkg_path = path.join(path.dirname(binary_path), 'msi', 'Servo.msi')
|
||||||
exec_command = ["msiexec", "/i", pkg_path]
|
exec_command = ["msiexec", "/i", pkg_path]
|
||||||
|
@ -426,7 +427,7 @@ class PackageCommands(CommandBase):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
print(" ".join(exec_command))
|
print(" ".join(exec_command))
|
||||||
return subprocess.call(exec_command, env=self.build_env())
|
return subprocess.call(exec_command, env=env)
|
||||||
|
|
||||||
@Command('upload-nightly',
|
@Command('upload-nightly',
|
||||||
description='Upload Servo nightly to S3',
|
description='Upload Servo nightly to S3',
|
||||||
|
|
|
@ -93,7 +93,7 @@ class PostBuildCommands(CommandBase):
|
||||||
"am start com.mozilla.servo/com.mozilla.servo.MainActivity",
|
"am start com.mozilla.servo/com.mozilla.servo.MainActivity",
|
||||||
"exit"
|
"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")
|
shell.communicate("\n".join(script) + "\n")
|
||||||
return shell.wait()
|
return shell.wait()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue