diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2015-11-13 21:35:50 +0100 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2015-11-13 21:35:50 +0100 |
commit | 8051f2ff8c501c4cd9991b26a8172862538bdc2c (patch) | |
tree | de01937941c445ca8c69906eac2cf28a472ddeef /python/servo/post_build_commands.py | |
parent | 50be4bb09ea42926a3bddb75a024e92a75e2047e (diff) | |
download | servo-8051f2ff8c501c4cd9991b26a8172862538bdc2c.tar.gz servo-8051f2ff8c501c4cd9991b26a8172862538bdc2c.zip |
Very hackish support for `./mach run --android`
Diffstat (limited to 'python/servo/post_build_commands.py')
-rw-r--r-- | python/servo/post_build_commands.py | 22 |
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: |