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

Add mach bootstrap-android and test-android-startup commands #21094

Merged
merged 30 commits into from Jul 2, 2018
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b9d5f11
Add `./mach bootstrap-android`
SimonSapin Jun 21, 2018
510cf1a
boostrap: set executable bits when extracting zip files
SimonSapin Jun 21, 2018
56df7f4
Install complete Android SDK (as much as on Buildbot CI)
SimonSapin Jun 21, 2018
244a332
Use more recent Android tools
SimonSapin Jun 25, 2018
1ee54ab
Create and Android virtual device
SimonSapin Jun 25, 2018
8889742
mach bootstrap-android: configure and show how to start an emulator
SimonSapin Jun 25, 2018
fe24816
mach run --android: show PID
SimonSapin Jun 25, 2018
4cbf3de
mach {package,install} --android: add --emulator and --usb
SimonSapin Jun 25, 2018
eab971c
Android cross-compiled command line hello world
SimonSapin Jun 25, 2018
90ba22b
egl-configs: link to EGL and generate bindings
SimonSapin Jun 25, 2018
89f6c6d
egl-configs: get the number of configs
SimonSapin Jun 25, 2018
7e7316e
egl-configs: print all config attributes
SimonSapin Jun 25, 2018
1f8d04b
egl-configs: print hex too
SimonSapin Jun 25, 2018
6e68705
cargo run into Android/adb: configurable target device
SimonSapin Jun 25, 2018
484eee8
Tidy
SimonSapin Jun 25, 2018
3c992af
Remove debugging println from a year ago
SimonSapin Jun 26, 2018
7d7f202
Fix copy/paste mistake
SimonSapin Jun 26, 2018
b7a8b81
egl-configs: add i686 support
SimonSapin Jun 26, 2018
f4d740f
Typo fixes
SimonSapin Jun 27, 2018
e54ad77
Do not prompt for Android emulator hardware profile
SimonSapin Jun 28, 2018
0e2e9cb
Create emulator images for both ARM and x86
SimonSapin Jun 28, 2018
aa1c3ce
bootstrap-android: use predictable paths for SDK and NDK
SimonSapin Jun 28, 2018
65122b1
bootstrap-android: always run sdkmanager
SimonSapin Jun 28, 2018
fc77db4
Use the bootstraped Android toolchains by default
SimonSapin Jun 28, 2018
b6b9fe0
Add "./mach android-emulator"
SimonSapin Jun 28, 2018
9e544c2
Remove the egl-configs diagnostic program
SimonSapin Jun 29, 2018
8293b29
bootstrap-android: check SHA1 hashes of downloaded archives
SimonSapin Jun 29, 2018
bee3fd0
mach android-emulator: avoid mach error messages for Python exceptions
SimonSapin Jun 29, 2018
eecbe83
Add ./mach test-android-startup
SimonSapin Jun 29, 2018
c0d1b8e
Android: increase emulator disk size, for debug builds
SimonSapin Jul 2, 2018
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

mach {package,install} --android: add --emulator and --usb

  • Loading branch information
SimonSapin committed Jul 2, 2018
commit 4cbf3dea054469c03551b19afc8a819dc52a453e
@@ -389,10 +389,16 @@ def package(self, release=False, dev=False, android=None, debug=False, debugger=
@CommandArgument('--android',
action='store_true',
help='Install on Android')
@CommandArgument('--emulator',
action='store_true',
help='For Android, intall to the only emulated device')
@CommandArgument('--usb',
action='store_true',
help='For Android, intall to the only USB device')
@CommandArgument('--target', '-t',
default=None,
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, emulator=False, usb=False, target=None):
env = self.build_env()
if target and android:
print("Please specify either --target or --android.")
@@ -416,7 +422,15 @@ def install(self, release=False, dev=False, android=False, target=None):

if android:
pkg_path = binary_path + ".apk"
exec_command = [self.android_adb_path(env), "install", "-r", pkg_path]
exec_command = [self.android_adb_path(env)]
if emulator and usb:
print("Cannot install to both emulator and USB at the same time.")
return 1
if emulator:
exec_command += ["-e"]

This comment has been minimized.

@paulrouget

paulrouget Jun 28, 2018

Contributor

Do we need a helper to start the emulator? We installed it. We push and run to the emulator. Maybe we should also start it somehow? Or test if it's running, and if not, check if the toolchain is present and print the command to run it.

This comment has been minimized.

@SimonSapin

SimonSapin Jun 28, 2018

Author Member

Added ./mach android-emulator which just forwards arguments to the emulator script. I’ll look later into having ./mach run start it automatically.

This comment has been minimized.

@SimonSapin

SimonSapin Jun 28, 2018

Author Member

One difficulty is that after starting the emulator and after adb wait-for-device returns (which shows that adb shell is responsive), the userland might not have finished booting yet. In particular, there is an indeterminate amount of time until the Activity Manager is running and the am start command would success. This time can be especially long for emulator ARM. (Or x86 without working CPU acceleration.)

if usb:
exec_command += ["-d"]
exec_command += ["install", "-r", pkg_path]
elif is_windows():
pkg_path = path.join(path.dirname(binary_path), 'msi', 'Servo.msi')
exec_command = ["msiexec", "/i", pkg_path]
@@ -45,6 +45,12 @@ class PostBuildCommands(CommandBase):
help='Run the dev build')
@CommandArgument('--android', action='store_true', default=None,
help='Run on an Android device through `adb shell`')
@CommandArgument('--emulator',
action='store_true',
help='For Android, intall to the only emulated device')
@CommandArgument('--usb',
action='store_true',
help='For Android, intall to the only USB device')
@CommandArgument('--debug', action='store_true',
help='Enable the debugger. Not specifying a '
'--debugger option will result in the default '
@@ -64,7 +70,7 @@ class PostBuildCommands(CommandBase):
'params', nargs='...',
help="Command-line arguments to be passed through to Servo")
def run(self, params, release=False, dev=False, android=None, debug=False, debugger=None,
headless=False, software=False, bin=None, nightly=None):
headless=False, software=False, bin=None, emulator=False, usb=False, nightly=None):
env = self.build_env()
env["RUST_BACKTRACE"] = "1"

@@ -95,7 +101,15 @@ def run(self, params, release=False, dev=False, android=None, debug=False, debug
"echo Servo PID: $(pidof com.mozilla.servo)",
"exit"
]
shell = subprocess.Popen([self.android_adb_path(env), "shell"], stdin=subprocess.PIPE)
args = [self.android_adb_path(env)]
if emulator and usb:
print("Cannot install to both emulator and USB at the same time.")
return 1
if emulator:
args += ["-e"]
if usb:
args += ["-d"]
shell = subprocess.Popen(args + ["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.