mirror of
https://github.com/servo/servo.git
synced 2025-06-10 17:43:16 +00:00
Very hackish support for ./mach run --android
This commit is contained in:
parent
50be4bb09e
commit
8051f2ff8c
1 changed files with 21 additions and 1 deletions
|
@ -41,6 +41,8 @@ class PostBuildCommands(CommandBase):
|
|||
help='Run the release build')
|
||||
@CommandArgument('--dev', '-d', action='store_true',
|
||||
help='Run the dev build')
|
||||
@CommandArgument('--android', action='store_true',
|
||||
help='Run on an Android device through `adb shell`')
|
||||
@CommandArgument('--debug', action='store_true',
|
||||
help='Enable the debugger. Not specifying a '
|
||||
'--debugger option will result in the default '
|
||||
|
@ -51,11 +53,29 @@ class PostBuildCommands(CommandBase):
|
|||
@CommandArgument(
|
||||
'params', nargs='...',
|
||||
help="Command-line arguments to be passed through to Servo")
|
||||
def run(self, params, release=False, dev=False, debug=False, debugger=None):
|
||||
def run(self, params, release=False, dev=False, android=False, debug=False, debugger=None):
|
||||
env = self.build_env()
|
||||
env["RUST_BACKTRACE"] = "1"
|
||||
|
||||
if android:
|
||||
if debug:
|
||||
print("Android on-device debugging is not supported by mach yet. See")
|
||||
print("https://github.com/servo/servo/wiki/Building-for-Android#debugging-on-device")
|
||||
return
|
||||
if params:
|
||||
url = params[0]
|
||||
else:
|
||||
url = 'http://mozilla.org/'
|
||||
subprocess.Popen(["adb", "shell"], stdin=subprocess.PIPE).communicate('''
|
||||
am force-stop com.mozilla.servo
|
||||
export SERVO_URL='%s'
|
||||
am start com.mozilla.servo/com.mozilla.servo.MainActivity
|
||||
exit
|
||||
''' % url.replace('\'', '\\\''))
|
||||
return
|
||||
|
||||
args = [self.get_binary_path(release, dev)]
|
||||
|
||||
# Borrowed and modified from:
|
||||
# http://hg.mozilla.org/mozilla-central/file/c9cfa9b91dea/python/mozbuild/mozbuild/mach_commands.py#l883
|
||||
if debug:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue