Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: mojo/tools/android_mojo_shell.py

Issue 1144673003: Fix and cleanup Mojo and Mandoline python scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mandoline/tools/android_run_mandoline.py ('k') | mojo/tools/apptest_runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 from mopy.config import Config 11 from mopy.config import Config
12 from mopy.paths import Paths 12 from mopy.paths import Paths
13 13
14 USAGE = ("android_mojo_shell.py [<shell-and-app-args>] [<mojo-app>]") 14 USAGE = ("android_mojo_shell.py [<shell-and-app-args>] [<mojo-app>]")
15 15
16 def main(): 16 def main():
17 logging.basicConfig() 17 logging.basicConfig()
18 18
19 parser = argparse.ArgumentParser(usage=USAGE) 19 parser = argparse.ArgumentParser(usage=USAGE)
20 20
21 debug_group = parser.add_mutually_exclusive_group() 21 debug_group = parser.add_mutually_exclusive_group()
22 debug_group.add_argument('--debug', help='Debug build (default)', 22 debug_group.add_argument('--debug', help='Debug build (default)',
23 default=True, action='store_true') 23 default=True, action='store_true')
24 debug_group.add_argument('--release', help='Release build', default=False, 24 debug_group.add_argument('--release', help='Release build', default=False,
25 dest='debug', action='store_false') 25 dest='debug', action='store_false')
26 parser.add_argument('--target-cpu', help='CPU architecture to run for.', 26 parser.add_argument('--target-cpu', help='CPU architecture to run for.',
27 choices=['x64', 'x86', 'arm']) 27 choices=['x64', 'x86', 'arm'], default='arm')
28 parser.add_argument('--origin', help='Origin for mojo: URLs.', 28 parser.add_argument('--origin', help='Origin for mojo: URLs.',
29 default='localhost') 29 default='localhost')
30 parser.add_argument('--target-device', help='Device to run on.') 30 parser.add_argument('--target-device', help='Device to run on.')
31 launcher_args, args = parser.parse_known_args() 31 launcher_args, args = parser.parse_known_args()
32 32
33 config = Config(target_os=Config.OS_ANDROID, 33 config = Config(target_os=Config.OS_ANDROID,
34 target_cpu=launcher_args.target_cpu, 34 target_cpu=launcher_args.target_cpu,
35 is_debug=launcher_args.debug, 35 is_debug=launcher_args.debug,
36 apk_name="MojoRunner.apk") 36 apk_name="MojoRunner.apk")
37 paths = Paths(config) 37 paths = Paths(config)
38 shell = AndroidShell(paths.target_mojo_shell_path, paths.build_dir, 38 shell = AndroidShell(paths.mojo_runner, paths.build_dir, paths.adb_path,
39 paths.adb_path, launcher_args.target_device) 39 launcher_args.target_device)
40 40
41 extra_shell_args = shell.PrepareShellRun(launcher_args.origin) 41 extra_shell_args = shell.PrepareShellRun(launcher_args.origin)
42 args.extend(extra_shell_args) 42 args.extend(extra_shell_args)
43 43
44 shell.CleanLogs() 44 shell.CleanLogs()
45 p = shell.ShowLogs() 45 p = shell.ShowLogs()
46 shell.StartShell(args, sys.stdout, p.terminate) 46 shell.StartShell(args, sys.stdout, p.terminate)
47 return 0 47 return 0
48 48
49 49
50 if __name__ == "__main__": 50 if __name__ == "__main__":
51 sys.exit(main()) 51 sys.exit(main())
OLDNEW
« no previous file with comments | « mandoline/tools/android_run_mandoline.py ('k') | mojo/tools/apptest_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698