| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import argparse | 6 import argparse |
| 7 import logging | 7 import logging |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 from mopy.config import Config | 10 from mopy.config import Config |
| 11 from mopy.paths import Paths | |
| 12 from mopy import android | 11 from mopy import android |
| 13 | 12 |
| 14 USAGE = ("android_mojo_shell.py " | 13 USAGE = ("android_mojo_shell.py " |
| 15 "[--args-for=<mojo-app>] " | 14 "[--args-for=<mojo-app>] " |
| 16 "[--content-handlers=<handlers>] " | 15 "[--content-handlers=<handlers>] " |
| 17 "[--enable-external-applications] " | 16 "[--enable-external-applications] " |
| 18 "[--disable-cache] " | 17 "[--disable-cache] " |
| 19 "[--enable-multiprocess] " | 18 "[--enable-multiprocess] " |
| 20 "[--url-mappings=from1=to1,from2=to2] " | 19 "[--url-mappings=from1=to1,from2=to2] " |
| 21 "[<mojo-app>] " | 20 "[<mojo-app>] " |
| (...skipping 12 matching lines...) Expand all Loading... |
| 34 | 33 |
| 35 parser = argparse.ArgumentParser(usage=USAGE) | 34 parser = argparse.ArgumentParser(usage=USAGE) |
| 36 | 35 |
| 37 debug_group = parser.add_mutually_exclusive_group() | 36 debug_group = parser.add_mutually_exclusive_group() |
| 38 debug_group.add_argument('--debug', help='Debug build (default)', | 37 debug_group.add_argument('--debug', help='Debug build (default)', |
| 39 default=True, action='store_true') | 38 default=True, action='store_true') |
| 40 debug_group.add_argument('--release', help='Release build', default=False, | 39 debug_group.add_argument('--release', help='Release build', default=False, |
| 41 dest='debug', action='store_false') | 40 dest='debug', action='store_false') |
| 42 parser.add_argument('--target-cpu', help='CPU architecture to run for.', | 41 parser.add_argument('--target-cpu', help='CPU architecture to run for.', |
| 43 choices=['x64', 'x86', 'arm']) | 42 choices=['x64', 'x86', 'arm']) |
| 43 parser.add_argument('--origin', help='Origin for mojo: URLs.') |
| 44 launcher_args, args = parser.parse_known_args() | 44 launcher_args, args = parser.parse_known_args() |
| 45 | 45 |
| 46 config = Config(target_os=Config.OS_ANDROID, | 46 config = Config(target_os=Config.OS_ANDROID, |
| 47 target_cpu=launcher_args.target_cpu, | 47 target_cpu=launcher_args.target_cpu, |
| 48 is_debug=launcher_args.debug) | 48 is_debug=launcher_args.debug) |
| 49 | 49 |
| 50 args.append(android.PrepareShellRun(config)) | 50 extra_shell_args = android.PrepareShellRun(config, launcher_args.origin) |
| 51 args.extend(extra_shell_args) |
| 52 |
| 51 android.CleanLogs() | 53 android.CleanLogs() |
| 52 p = android.ShowLogs() | 54 p = android.ShowLogs() |
| 53 android.StartShell(args, sys.stdout, p.terminate) | 55 android.StartShell(args, sys.stdout, p.terminate) |
| 54 | |
| 55 return 0 | 56 return 0 |
| 56 | 57 |
| 57 | 58 |
| 58 if __name__ == "__main__": | 59 if __name__ == "__main__": |
| 59 sys.exit(main()) | 60 sys.exit(main()) |
| OLD | NEW |