aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2015-11-14 02:32:53 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2015-11-14 02:32:53 +0530
commit27e104aa1a62978bf2dd8b6a65963a2466af936a (patch)
tree4a8f410a0bd8a3b60d1c8d9e624715a216c45ecd
parent8c3d2235287767180180290622f9f259e821330c (diff)
parent8051f2ff8c501c4cd9991b26a8172862538bdc2c (diff)
downloadservo-27e104aa1a62978bf2dd8b6a65963a2466af936a.tar.gz
servo-27e104aa1a62978bf2dd8b6a65963a2466af936a.zip
Auto merge of #8520 - servo:android-run, r=larsbergstrom
Very hackish support for `./mach run --android` <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8520) <!-- Reviewable:end -->
-rw-r--r--python/servo/post_build_commands.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/python/servo/post_build_commands.py b/python/servo/post_build_commands.py
index 6e59895f956..5abffaeee4f 100644
--- a/python/servo/post_build_commands.py
+++ b/python/servo/post_build_commands.py
@@ -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: