blob: 58c6e736b4c9f5beb0b2b5c4fb145717a04938de [file] [log] [blame]
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import logging
import sys
from mopy.config import Config
from mopy.paths import Paths
from mopy import android
USAGE = ("android_mojo_shell.py "
"[--args-for=<mojo-app>] "
"[--content-handlers=<handlers>] "
"[--enable-external-applications] "
"[--disable-cache] "
"[--enable-multiprocess] "
"[--url-mappings=from1=to1,from2=to2] "
"[<mojo-app>] "
"""
A <mojo-app> is a Mojo URL or a Mojo URL and arguments within quotes.
Example: mojo_shell "mojo:js_standalone test.js".
<url-lib-path> is searched for shared libraries named by mojo URLs.
The value of <handlers> is a comma separated list like:
text/html,mojo:html_viewer,application/javascript,mojo:js_content_handler
""")
def main():
logging.basicConfig()
parser = argparse.ArgumentParser(usage=USAGE)
debug_group = parser.add_mutually_exclusive_group()
debug_group.add_argument('--debug', help='Debug build (default)',
default=True, action='store_true')
debug_group.add_argument('--release', help='Release build', default=False,
dest='debug', action='store_false')
launcher_args, args = parser.parse_known_args()
config = Config(target_os=Config.OS_ANDROID, is_debug=launcher_args.debug)
context = android.PrepareShellRun(config)
android.CleanLogs(context)
p = android.ShowLogs()
android.StartShell(context, args, sys.stdout, p.terminate)
return 0
if __name__ == "__main__":
sys.exit(main())