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

Side by Side Diff: mojo/devtools/common/devtoolslib/shell_config.py

Issue 1397193005: mojo_run: support parallel Android runs of mojo_run. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 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 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Configuration for the shell abstraction. 5 """Configuration for the shell abstraction.
6 6
7 This module declares ShellConfig and knows how to compute it from command-line 7 This module declares ShellConfig and knows how to compute it from command-line
8 arguments, applying any default paths inferred from the checkout, configuration 8 arguments, applying any default paths inferred from the checkout, configuration
9 file, etc. 9 file, etc.
10 """ 10 """
(...skipping 19 matching lines...) Expand all
30 self.map_origin_list = [] 30 self.map_origin_list = []
31 self.dev_servers = [] 31 self.dev_servers = []
32 self.content_handlers = dict() 32 self.content_handlers = dict()
33 self.verbose = None 33 self.verbose = None
34 34
35 # Android-only. 35 # Android-only.
36 self.adb_path = None 36 self.adb_path = None
37 self.target_device = None 37 self.target_device = None
38 self.logcat_tags = None 38 self.logcat_tags = None
39 self.require_root = False 39 self.require_root = False
40 self.free_host_ports = False
40 41
41 # Desktop-only. 42 # Desktop-only.
42 self.use_osmesa = None 43 self.use_osmesa = None
43 44
44 45
45 class DevServerConfig(object): 46 class DevServerConfig(object):
46 """Configuration for a development server running on a host and available to 47 """Configuration for a development server running on a host and available to
47 the shell. 48 the shell.
48 """ 49 """
49 def __init__(self): 50 def __init__(self):
(...skipping 20 matching lines...) Expand all
70 '<origin>=<url-or-local-file-path>') 71 '<origin>=<url-or-local-file-path>')
71 parser.add_argument('-v', '--verbose', action="store_true", 72 parser.add_argument('-v', '--verbose', action="store_true",
72 help="Increase output verbosity") 73 help="Increase output verbosity")
73 74
74 android_group = parser.add_argument_group('Android-only', 75 android_group = parser.add_argument_group('Android-only',
75 'These arguments apply only when --android is passed.') 76 'These arguments apply only when --android is passed.')
76 android_group.add_argument('--adb-path', help='Path of the adb binary.') 77 android_group.add_argument('--adb-path', help='Path of the adb binary.')
77 android_group.add_argument('--target-device', help='Device to run on.') 78 android_group.add_argument('--target-device', help='Device to run on.')
78 android_group.add_argument('--logcat-tags', help='Comma-separated list of ' 79 android_group.add_argument('--logcat-tags', help='Comma-separated list of '
79 'additional logcat tags to display.') 80 'additional logcat tags to display.')
81 android_group.add_argument('--free-host-ports', action='store_true',
82 help='Use system-allocated ports on the host when '
83 'spawning local servers.')
80 84
81 desktop_group = parser.add_argument_group('Desktop-only', 85 desktop_group = parser.add_argument_group('Desktop-only',
82 'These arguments apply only when running on desktop.') 86 'These arguments apply only when running on desktop.')
83 desktop_group.add_argument('--use-osmesa', action='store_true', 87 desktop_group.add_argument('--use-osmesa', action='store_true',
84 help='Configure the native viewport service ' 88 help='Configure the native viewport service '
85 'for off-screen rendering.') 89 'for off-screen rendering.')
86 90
87 config_file_group = parser.add_argument_group('Configuration file', 91 config_file_group = parser.add_argument_group('Configuration file',
88 'These arguments allow to modify the behavior regarding the mojoconfig ' 92 'These arguments allow to modify the behavior regarding the mojoconfig '
89 'file.') 93 'file.')
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 shell_config.origin = script_args.origin 153 shell_config.origin = script_args.origin
150 shell_config.map_url_list = script_args.map_url 154 shell_config.map_url_list = script_args.map_url
151 shell_config.map_origin_list = script_args.map_origin 155 shell_config.map_origin_list = script_args.map_origin
152 shell_config.verbose = script_args.verbose 156 shell_config.verbose = script_args.verbose
153 157
154 # Android-only. 158 # Android-only.
155 shell_config.adb_path = (script_args.adb_path or inferred_paths['adb_path'] or 159 shell_config.adb_path = (script_args.adb_path or inferred_paths['adb_path'] or
156 'adb') 160 'adb')
157 shell_config.target_device = script_args.target_device 161 shell_config.target_device = script_args.target_device
158 shell_config.logcat_tags = script_args.logcat_tags 162 shell_config.logcat_tags = script_args.logcat_tags
163 shell_config.free_host_ports = script_args.free_host_ports
159 164
160 # Desktop-only. 165 # Desktop-only.
161 shell_config.use_osmesa = script_args.use_osmesa 166 shell_config.use_osmesa = script_args.use_osmesa
162 167
163 if (shell_config.android and not shell_config.origin and 168 if (shell_config.android and not shell_config.origin and
164 inferred_paths['build_dir_path']): 169 inferred_paths['build_dir_path']):
165 shell_config.origin = inferred_paths['build_dir_path'] 170 shell_config.origin = inferred_paths['build_dir_path']
166 171
167 # Read the mojoconfig file. 172 # Read the mojoconfig file.
168 config_file = script_args.config_file 173 config_file = script_args.config_file
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 211
207 if 'content_handlers' in config: 212 if 'content_handlers' in config:
208 try: 213 try:
209 for (mime_type, 214 for (mime_type,
210 content_handler_url) in config['content_handlers'].iteritems(): 215 content_handler_url) in config['content_handlers'].iteritems():
211 shell_config.content_handlers[mime_type] = content_handler_url 216 shell_config.content_handlers[mime_type] = content_handler_url
212 except (ValueError, KeyError): 217 except (ValueError, KeyError):
213 raise ShellConfigurationException('Failed to parse content_handlers in ' 218 raise ShellConfigurationException('Failed to parse content_handlers in '
214 'the config file.') 219 'the config file.')
215 return shell_config 220 return shell_config
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698