| 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 os | 8 import os |
| 9 import sys | 9 import sys |
| 10 | 10 |
| 11 sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), | 11 sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), |
| 12 os.pardir, os.pardir, os.pardir, 'mojo', | 12 os.pardir, os.pardir, os.pardir, 'mojo', |
| 13 'tools')) | 13 'tools')) |
| 14 | 14 |
| 15 from mopy.android import AndroidShell | 15 from mopy.android import AndroidShell |
| 16 from mopy.config import Config | 16 from mopy.config import Config |
| 17 | 17 |
| 18 USAGE = ('install_mandoline.py [<shell-and-app-args>]') | 18 USAGE = ('install_mandoline.py [<shell-and-app-args>]') |
| 19 | 19 |
| 20 def main(): | 20 def main(): |
| 21 logging.basicConfig() | 21 logging.basicConfig() |
| 22 | 22 |
| 23 parser = argparse.ArgumentParser(usage=USAGE) | 23 parser = argparse.ArgumentParser(usage=USAGE) |
| 24 | 24 |
| 25 debug_group = parser.add_mutually_exclusive_group() | 25 debug_group = parser.add_mutually_exclusive_group() |
| 26 debug_group.add_argument('--debug', help='Debug build (default)', | 26 debug_group.add_argument('--debug', help='Debug build (default)', |
| 27 default=True, action='store_true') | 27 default=True, action='store_true') |
| 28 debug_group.add_argument('--release', help='Release build', default=False, | 28 debug_group.add_argument('--release', help='Release build', default=False, |
| 29 dest='debug', action='store_false') | 29 dest='debug', action='store_false') |
| 30 parser.add_argument('--build-dir', help='Build directory') |
| 30 parser.add_argument('--target-cpu', help='CPU architecture to run for.', | 31 parser.add_argument('--target-cpu', help='CPU architecture to run for.', |
| 31 choices=['x64', 'x86', 'arm'], default='arm') | 32 choices=['x64', 'x86', 'arm'], default='arm') |
| 32 parser.add_argument('--device', help='Serial number of the target device.') | 33 parser.add_argument('--device', help='Serial number of the target device.') |
| 33 runner_args, args = parser.parse_known_args() | 34 runner_args, args = parser.parse_known_args() |
| 34 | 35 |
| 35 config = Config(target_os=Config.OS_ANDROID, | 36 config = Config(build_dir=runner_args.build_dir, |
| 37 target_os=Config.OS_ANDROID, |
| 36 target_cpu=runner_args.target_cpu, | 38 target_cpu=runner_args.target_cpu, |
| 37 is_debug=runner_args.debug, | 39 is_debug=runner_args.debug, |
| 38 apk_name='Mandoline.apk') | 40 apk_name='Mandoline.apk') |
| 39 shell = AndroidShell(config) | 41 shell = AndroidShell(config) |
| 40 shell.InitShell(None, runner_args.device) | 42 shell.InitShell(None, runner_args.device) |
| 41 return 0 | 43 return 0 |
| 42 | 44 |
| 43 | 45 |
| 44 if __name__ == '__main__': | 46 if __name__ == '__main__': |
| 45 sys.exit(main()) | 47 sys.exit(main()) |
| OLD | NEW |