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

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

Issue 1157993010: Add --sky support in mojo_shell.py. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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/devtoolslib/http_server.py ('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 import os.path
9 10
10 import devtools 11 import devtools
11 devtools.add_lib_to_path() 12 devtools.add_lib_to_path()
12 from devtoolslib.android_shell import AndroidShell 13 from devtoolslib.android_shell import AndroidShell
13 from devtoolslib.linux_shell import LinuxShell 14 from devtoolslib.linux_shell import LinuxShell
14 from devtoolslib import shell_arguments 15 from devtoolslib import shell_arguments
15 16
16 from mopy.config import Config 17 from mopy.config import Config
17 from mopy.paths import Paths 18 from mopy.paths import Paths
18 19
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 choices=['x64', 'x86', 'arm']) 54 choices=['x64', 'x86', 'arm'])
54 55
55 # Arguments configuring the shell run. 56 # Arguments configuring the shell run.
56 parser.add_argument('--origin', help='Origin for mojo: URLs.') 57 parser.add_argument('--origin', help='Origin for mojo: URLs.')
57 parser.add_argument('--window-manager', default=_DEFAULT_WINDOW_MANAGER, 58 parser.add_argument('--window-manager', default=_DEFAULT_WINDOW_MANAGER,
58 help='Window manager app to be mapped as ' 59 help='Window manager app to be mapped as '
59 'mojo:window_manager. By default it is ' + 60 'mojo:window_manager. By default it is ' +
60 _DEFAULT_WINDOW_MANAGER) 61 _DEFAULT_WINDOW_MANAGER)
61 parser.add_argument('--no-debugger', action="store_true", 62 parser.add_argument('--no-debugger', action="store_true",
62 help='Do not spawn mojo:debugger.') 63 help='Do not spawn mojo:debugger.')
64 parser.add_argument('--sky',
qsr 2015/06/08 15:18:52 This is not only sky. This is for all embeddable a
ppi 2015/06/08 15:29:14 As discussed offline, this is quite sky specific,
65 help='Loads the given Sky file.')
63 parser.add_argument('-v', '--verbose', action="store_true", 66 parser.add_argument('-v', '--verbose', action="store_true",
64 help="Increase output verbosity") 67 help="Increase output verbosity")
65 68
66 # Android-only arguments. 69 # Android-only arguments.
67 parser.add_argument('--target-device', help='Device to run on.') 70 parser.add_argument('--target-device', help='Device to run on.')
68 parser.add_argument('--logcat-tags', help='Comma-separated list of ' 71 parser.add_argument('--logcat-tags', help='Comma-separated list of '
69 'additional logcat tags to display on the console.') 72 'additional logcat tags to display on the console.')
70 73
71 launcher_args, args = parser.parse_known_args() 74 launcher_args, args = parser.parse_known_args()
72 if launcher_args.android: 75 if launcher_args.android:
(...skipping 18 matching lines...) Expand all
91 shell = LinuxShell(paths.mojo_shell_path) 94 shell = LinuxShell(paths.mojo_shell_path)
92 95
93 if launcher_args.origin: 96 if launcher_args.origin:
94 args.append('--origin=' + launcher_args.origin) 97 args.append('--origin=' + launcher_args.origin)
95 args = shell_arguments.AppendToArgument(args, '--url-mappings=', 98 args = shell_arguments.AppendToArgument(args, '--url-mappings=',
96 'mojo:window_manager=%s' % 99 'mojo:window_manager=%s' %
97 launcher_args.window_manager) 100 launcher_args.window_manager)
98 if not launcher_args.no_debugger: 101 if not launcher_args.no_debugger:
99 args.extend(shell_arguments.ConfigureDebugger(shell)) 102 args.extend(shell_arguments.ConfigureDebugger(shell))
100 103
104 if launcher_args.sky:
105 packages_local_path = os.path.join(paths.build_dir, 'gen', 'dart-pkg',
106 'packages')
107 additional_mappings = [
108 ('packages/', packages_local_path),
109 ]
110 server_url = shell.ServeLocalDirectory(paths.src_root,
111 additional_mappings=additional_mappings)
112 sky_url = server_url + launcher_args.sky
113
114 args.append('mojo:window_manager %s' % sky_url)
115 args = shell_arguments.AppendToArgument(args, '--content-handlers=',
116 'text/sky,mojo:sky_viewer')
117 args = shell_arguments.AppendToArgument(args, '--content-handlers=',
118 'application/dart,mojo:sky_viewer')
119 if launcher_args.verbose:
120 print "Shell arguments: " + str(args)
121
101 shell.Run(args) 122 shell.Run(args)
102 return 0 123 return 0
103 124
104 125
105 if __name__ == "__main__": 126 if __name__ == "__main__":
106 sys.exit(main()) 127 sys.exit(main())
OLDNEW
« no previous file with comments | « mojo/devtools/common/devtoolslib/http_server.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698