| 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.android import AndroidShell | 10 from mopy.android import AndroidShell |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 parser = argparse.ArgumentParser(usage=USAGE) | 35 parser = argparse.ArgumentParser(usage=USAGE) |
| 36 | 36 |
| 37 debug_group = parser.add_mutually_exclusive_group() | 37 debug_group = parser.add_mutually_exclusive_group() |
| 38 debug_group.add_argument('--debug', help='Debug build (default)', | 38 debug_group.add_argument('--debug', help='Debug build (default)', |
| 39 default=True, action='store_true') | 39 default=True, action='store_true') |
| 40 debug_group.add_argument('--release', help='Release build', default=False, | 40 debug_group.add_argument('--release', help='Release build', default=False, |
| 41 dest='debug', action='store_false') | 41 dest='debug', action='store_false') |
| 42 parser.add_argument('--target-cpu', help='CPU architecture to run for.', | 42 parser.add_argument('--target-cpu', help='CPU architecture to run for.', |
| 43 choices=['x64', 'x86', 'arm']) | 43 choices=['x64', 'x86', 'arm']) |
| 44 parser.add_argument('--origin', help='Origin for mojo: URLs.') | 44 parser.add_argument('--origin', help='Origin for mojo: URLs.') |
| 45 parser.add_argument('--target-device', help='Device to run on.') |
| 45 launcher_args, args = parser.parse_known_args() | 46 launcher_args, args = parser.parse_known_args() |
| 46 | 47 |
| 47 config = Config(target_os=Config.OS_ANDROID, | 48 config = Config(target_os=Config.OS_ANDROID, |
| 48 target_cpu=launcher_args.target_cpu, | 49 target_cpu=launcher_args.target_cpu, |
| 49 is_debug=launcher_args.debug) | 50 is_debug=launcher_args.debug) |
| 50 paths = Paths(config) | 51 paths = Paths(config) |
| 51 shell = AndroidShell(paths.target_mojo_shell_path, paths.build_dir, | 52 shell = AndroidShell(paths.target_mojo_shell_path, paths.build_dir, |
| 52 paths.adb_path) | 53 paths.adb_path, launcher_args.target_device) |
| 53 | 54 |
| 54 extra_shell_args = shell.PrepareShellRun(launcher_args.origin) | 55 extra_shell_args = shell.PrepareShellRun(launcher_args.origin) |
| 55 args.extend(extra_shell_args) | 56 args.extend(extra_shell_args) |
| 56 | 57 |
| 57 shell.CleanLogs() | 58 shell.CleanLogs() |
| 58 p = shell.ShowLogs() | 59 p = shell.ShowLogs() |
| 59 shell.StartShell(args, sys.stdout, p.terminate) | 60 shell.StartShell(args, sys.stdout, p.terminate) |
| 60 return 0 | 61 return 0 |
| 61 | 62 |
| 62 | 63 |
| 63 if __name__ == "__main__": | 64 if __name__ == "__main__": |
| 64 sys.exit(main()) | 65 sys.exit(main()) |
| OLD | NEW |