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
4 # found in the LICENSE file.
11 sys
.path
.insert(0, os
.path
.join(os
.path
.abspath(os
.path
.dirname(__file__
)),
14 from mopy
.android
import AndroidShell
15 from mopy
.config
import Config
17 USAGE
= ("android_run_mandoline.py [<shell-and-app-args>] [<mojo-app>]")
22 parser
= argparse
.ArgumentParser(usage
=USAGE
)
24 debug_group
= parser
.add_mutually_exclusive_group()
25 debug_group
.add_argument('--debug', help='Debug build (default)',
26 default
=True, action
='store_true')
27 debug_group
.add_argument('--release', help='Release build', default
=False,
28 dest
='debug', action
='store_false')
29 parser
.add_argument('--target-cpu', help='CPU architecture to run for.',
30 choices
=['x64', 'x86', 'arm'], default
='arm')
31 parser
.add_argument('--device', help='Serial number of the target device.')
32 parser
.add_argument('--gdb', help='Run gdb',
33 default
=False, action
='store_true')
34 runner_args
, args
= parser
.parse_known_args()
36 config
= Config(target_os
=Config
.OS_ANDROID
,
37 target_cpu
=runner_args
.target_cpu
,
38 is_debug
=runner_args
.debug
,
39 apk_name
="Mandoline.apk")
40 shell
= AndroidShell(config
)
41 args
.extend(shell
.PrepareShellRun(None, runner_args
.device
, runner_args
.gdb
))
45 shell
.StartShell(args
, sys
.stdout
, p
.terminate
, runner_args
.gdb
)
49 if __name__
== "__main__":