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

Side by Side Diff: mojo/devtools/common/mojo_run

Issue 1253273003: Unify casing of function names in devtools. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase. Created 5 years, 4 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
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 devtoolslib import paths 10 from devtoolslib import paths
(...skipping 17 matching lines...) Expand all
28 28
29 _DESCRIPTION = """Runner for Mojo applications. 29 _DESCRIPTION = """Runner for Mojo applications.
30 30
31 Any arguments not recognized by the script will be passed on as shell arguments. 31 Any arguments not recognized by the script will be passed on as shell arguments.
32 """ 32 """
33 33
34 34
35 # Port on which the mojo:debugger http server will be available on the host 35 # Port on which the mojo:debugger http server will be available on the host
36 # machine. 36 # machine.
37 _MOJO_DEBUGGER_PORT = 7777 37 _MOJO_DEBUGGER_PORT = 7777
38
39 _DEFAULT_WINDOW_MANAGER = "mojo:kiosk_wm" 38 _DEFAULT_WINDOW_MANAGER = "mojo:kiosk_wm"
40 39
41 40
42 def _ConfigureDebugger(shell): 41 def _configure_debugger(shell):
43 """Configures mojo:debugger to run and sets up port forwarding for its http 42 """Configures mojo:debugger to run and sets up port forwarding for its http
44 server if the shell is running on a device. 43 server if the shell is running on a device.
45 44
46 Returns: 45 Returns:
47 Arguments that need to be appended to the shell argument list in order to 46 Arguments that need to be appended to the shell argument list in order to
48 run with the debugger. 47 run with the debugger.
49 """ 48 """
50 shell.ForwardHostPortToShell(_MOJO_DEBUGGER_PORT) 49 shell.ForwardHostPortToShell(_MOJO_DEBUGGER_PORT)
51 return ['mojo:debugger %d' % _MOJO_DEBUGGER_PORT] 50 return ['mojo:debugger %d' % _MOJO_DEBUGGER_PORT]
52 51
(...skipping 11 matching lines...) Expand all
64 'when running withing a Chromium-like checkout') 63 'when running withing a Chromium-like checkout')
65 debug_group = chromium_config_group.add_mutually_exclusive_group() 64 debug_group = chromium_config_group.add_mutually_exclusive_group()
66 debug_group.add_argument('--debug', help='Debug build (default)', 65 debug_group.add_argument('--debug', help='Debug build (default)',
67 default=True, action='store_true') 66 default=True, action='store_true')
68 debug_group.add_argument('--release', help='Release build', default=False, 67 debug_group.add_argument('--release', help='Release build', default=False,
69 dest='debug', action='store_false') 68 dest='debug', action='store_false')
70 chromium_config_group.add_argument('--target-cpu', 69 chromium_config_group.add_argument('--target-cpu',
71 help='CPU architecture to run for.', 70 help='CPU architecture to run for.',
72 choices=['x64', 'x86', 'arm']) 71 choices=['x64', 'x86', 'arm'])
73 72
74 shell_arguments.AddShellArguments(parser) 73 shell_arguments.add_shell_arguments(parser)
75 parser.add_argument('--no-debugger', action="store_true", 74 parser.add_argument('--no-debugger', action="store_true",
76 help='Do not spawn mojo:debugger.') 75 help='Do not spawn mojo:debugger.')
77 parser.add_argument('--window-manager', default=_DEFAULT_WINDOW_MANAGER, 76 parser.add_argument('--window-manager', default=_DEFAULT_WINDOW_MANAGER,
78 help='Window manager app to be mapped as ' 77 help='Window manager app to be mapped as '
79 'mojo:window_manager. By default it is ' + 78 'mojo:window_manager. By default it is ' +
80 _DEFAULT_WINDOW_MANAGER) 79 _DEFAULT_WINDOW_MANAGER)
81 parser.add_argument('--sky', 80 parser.add_argument('--sky',
82 help='Loads the given Sky file.') 81 help='Loads the given Sky file.')
83 82
84 script_args, shell_args = parser.parse_known_args() 83 script_args, shell_args = parser.parse_known_args()
(...skipping 14 matching lines...) Expand all
99 print 'Running within a Chromium-style checkout.' 98 print 'Running within a Chromium-style checkout.'
100 print ' - using the locally built shell at: ' + script_args.shell_path 99 print ' - using the locally built shell at: ' + script_args.shell_path
101 if script_args.origin: 100 if script_args.origin:
102 print ' - using the origin: ' + script_args.origin 101 print ' - using the origin: ' + script_args.origin
103 if script_args.android: 102 if script_args.android:
104 print ' - using the adb path: ' + script_args.adb_path 103 print ' - using the adb path: ' + script_args.adb_path
105 elif script_args.verbose: 104 elif script_args.verbose:
106 print 'Running outside a Chromium-style checkout.' 105 print 'Running outside a Chromium-style checkout.'
107 106
108 try: 107 try:
109 shell, shell_args = shell_arguments.ConfigureShell(script_args, shell_args) 108 shell, shell_args = shell_arguments.configure_shell(script_args, shell_args)
110 except shell_arguments.ShellConfigurationException as e: 109 except shell_arguments.ShellConfigurationException as e:
111 print e 110 print e
112 return 1 111 return 1
113 112
114 if not script_args.no_debugger: 113 if not script_args.no_debugger:
115 if script_args.verbose: 114 if script_args.verbose:
116 print 'Spawning mojo:debugger, use `mojo_debug` to inspect the shell.' 115 print 'Spawning mojo:debugger, use `mojo_debug` to inspect the shell.'
117 print 'Note that mojo:debugger will prevent the shell from terminating,' 116 print 'Note that mojo:debugger will prevent the shell from terminating,'
118 print ' pass --no-debugger to skip spawning mojo:debugger.' 117 print ' pass --no-debugger to skip spawning mojo:debugger.'
119 shell_args.extend(_ConfigureDebugger(shell)) 118 shell_args.extend(_configure_debugger(shell))
120 119
121 shell_args = shell_arguments.AppendToArgument(shell_args, '--url-mappings=', 120 shell_args = shell_arguments.append_to_argument(shell_args, '--url-mappings=',
122 'mojo:window_manager=%s' % 121 'mojo:window_manager=%s' %
123 script_args.window_manager) 122 script_args.window_manager)
124 123
125 if script_args.sky: 124 if script_args.sky:
126 if not mojo_paths: 125 if not mojo_paths:
127 print 'Running with --sky is not supported outside of the Mojo checkout.' 126 print 'Running with --sky is not supported outside of the Mojo checkout.'
128 # See https://github.com/domokit/devtools/issues/27. 127 # See https://github.com/domokit/devtools/issues/27.
129 return 1 128 return 1
130 shell_args.extend(shell_arguments.ConfigureSky(shell, mojo_paths['root'], 129 shell_args.extend(shell_arguments._configure_sky(shell, mojo_paths['root'],
131 mojo_paths['sky_packages'], 130 mojo_paths['sky_packages'],
132 script_args.sky)) 131 script_args.sky))
133 132
134 if script_args.verbose: 133 if script_args.verbose:
135 print "Shell arguments: " + str(shell_args) 134 print "Shell arguments: " + str(shell_args)
136 135
137 shell.Run(shell_args) 136 shell.Run(shell_args)
138 return 0 137 return 0
139 138
140 139
141 if __name__ == "__main__": 140 if __name__ == "__main__":
142 sys.exit(main()) 141 sys.exit(main())
OLDNEW
« no previous file with comments | « mojo/devtools/common/devtoolslib/shell_arguments_unittest.py ('k') | mojo/devtools/common/mojo_test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698