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

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

Issue 1782443005: Update mojo_run to use mojo:launcher instead of mojo:kiosk_wm. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 9 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 | « mojo/devtools/common/docs/mojo_run.md ('k') | no next file » | 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 devtoolslib import shell_arguments 10 from devtoolslib import shell_arguments
(...skipping 12 matching lines...) Expand all
23 "<mojo-app-url>" 23 "<mojo-app-url>"
24 "<mojo-app-url> <arguments>" 24 "<mojo-app-url> <arguments>"
25 25
26 The value of <handlers> is a comma separated list like: 26 The value of <handlers> is a comma separated list like:
27 text/html,mojo:html_viewer,application/javascript,mojo:js_content_handler 27 text/html,mojo:html_viewer,application/javascript,mojo:js_content_handler
28 """ 28 """
29 29
30 # Port on which the mojo:debugger http server will be available on the host 30 # Port on which the mojo:debugger http server will be available on the host
31 # machine. 31 # machine.
32 _MOJO_DEBUGGER_PORT = 7777 32 _MOJO_DEBUGGER_PORT = 7777
33 _DEFAULT_WM = 'mojo:kiosk_wm' 33 _LAUNCHER = 'mojo:launcher'
34 34
35 _WM_URL = 'mojo:window_manager'
36 _DEBUGGER_URL = 'https://core.mojoapps.io/debugger.mojo' 35 _DEBUGGER_URL = 'https://core.mojoapps.io/debugger.mojo'
37 36
38 37
39 def _configure_debugger(shell): 38 def _configure_debugger(shell):
40 """Configures debugger.mojo to run and sets up port forwarding for its http 39 """Configures debugger.mojo to run and sets up port forwarding for its http
41 server if the shell is running on a device. 40 server if the shell is running on a device.
42 41
43 Returns: 42 Returns:
44 Arguments that need to be appended to the shell argument list in order to 43 Arguments that need to be appended to the shell argument list in order to
45 run with the debugger. 44 run with the debugger.
46 """ 45 """
47 shell.forward_host_port_to_shell(_MOJO_DEBUGGER_PORT) 46 shell.forward_host_port_to_shell(_MOJO_DEBUGGER_PORT)
48 return ['%s %d' % (_DEBUGGER_URL, _MOJO_DEBUGGER_PORT)] 47 return ['%s %d' % (_DEBUGGER_URL, _MOJO_DEBUGGER_PORT)]
49 48
50 49
51 def main(): 50 def main():
52 logging.basicConfig() 51 logging.basicConfig()
53 52
54 parser = argparse.ArgumentParser( 53 parser = argparse.ArgumentParser(
55 formatter_class=argparse.RawDescriptionHelpFormatter, 54 formatter_class=argparse.RawDescriptionHelpFormatter,
56 description=_DESCRIPTION) 55 description=_DESCRIPTION)
57 shell_config.add_shell_arguments(parser) 56 shell_config.add_shell_arguments(parser)
58 57
59 parser.add_argument('--embed', type=str, 58 parser.add_argument('--embed', type=str,
60 help='Url to be embedded in the window manager.') 59 help='Url to be embedded in the window manager.')
61 parser.add_argument('--window-manager', default=_DEFAULT_WM,
62 help='Window manager app to be mapped as '
63 'mojo:window_manager. By default it is ' +
64 _DEFAULT_WM)
65 parser.add_argument('--debugger', action="store_true", 60 parser.add_argument('--debugger', action="store_true",
66 help='Run debugger.mojo along with the app.') 61 help='Run debugger.mojo along with the app.')
67 62
68 script_args, shell_args = parser.parse_known_args() 63 script_args, shell_args = parser.parse_known_args()
69 64
70 try: 65 try:
71 config = shell_config.get_shell_config(script_args) 66 config = shell_config.get_shell_config(script_args)
72 shell, shell_args = shell_arguments.get_shell(config, shell_args) 67 shell, shell_args = shell_arguments.get_shell(config, shell_args)
73 except shell_config.ShellConfigurationException as e: 68 except shell_config.ShellConfigurationException as e:
74 print e 69 print e
75 return 1 70 return 1
76 71
77 shell_args = shell_arguments.append_to_argument(shell_args, '--url-mappings=',
78 '%s=%s' % (_WM_URL,
79 script_args.window_manager))
80
81 if script_args.embed: 72 if script_args.embed:
82 shell_args.append('%s %s' % (script_args.window_manager, script_args.embed)) 73 shell_args.append('%s %s' % (_LAUNCHER, script_args.embed))
83 74
84 if script_args.debugger: 75 if script_args.debugger:
85 if script_args.verbose: 76 if script_args.verbose:
86 print 'Spawning mojo:debugger, use `mojo_debug` to inspect the shell.' 77 print 'Spawning mojo:debugger, use `mojo_debug` to inspect the shell.'
87 print 'Note that mojo:debugger will prevent the shell from terminating,' 78 print 'Note that mojo:debugger will prevent the shell from terminating,'
88 print ' pass --no-debugger to skip spawning mojo:debugger.' 79 print ' pass --no-debugger to skip spawning mojo:debugger.'
89 shell_args.extend(_configure_debugger(shell)) 80 shell_args.extend(_configure_debugger(shell))
90 81
91 if script_args.verbose: 82 if script_args.verbose:
92 print "Shell arguments: " + str(shell_args) 83 print "Shell arguments: " + str(shell_args)
93 84
94 shell.run(shell_args) 85 shell.run(shell_args)
95 return 0 86 return 0
96 87
97 88
98 if __name__ == "__main__": 89 if __name__ == "__main__":
99 sys.exit(main()) 90 sys.exit(main())
OLDNEW
« no previous file with comments | « mojo/devtools/common/docs/mojo_run.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698