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

Unified Diff: mojo/devtools/common/devtoolslib/shell_arguments.py

Issue 1264763003: Don't emulate Sky server when --sky is passed. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/devtools/common/devtoolslib/paths.py ('k') | mojo/devtools/common/mojo_run » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/devtools/common/devtoolslib/shell_arguments.py
diff --git a/mojo/devtools/common/devtoolslib/shell_arguments.py b/mojo/devtools/common/devtoolslib/shell_arguments.py
index 1f2a97f6d9156cea71483a05de9baa49d5c7d7da..bd818e8caf74f3fea727d6336300977015d916bc 100644
--- a/mojo/devtools/common/devtoolslib/shell_arguments.py
+++ b/mojo/devtools/common/devtoolslib/shell_arguments.py
@@ -100,45 +100,25 @@ def _apply_mappings(shell, original_arguments, map_urls, map_origins):
return args
-def _configure_sky(shell, root_path, sky_packages_path, sky_target):
- """Configures additional mappings and a server needed to run the given Sky
+def _configure_sky(shell_args):
+ """Maps mojo:sky_viewer as a content handler for dart applications.
app.
Args:
- root_path: Local path to the root from which Sky apps will be served.
- sky_packages_path: Local path to the root from which Sky packages will be
- served.
- sky_target: Path to the Sky app to be run, relative to |root_path|.
+ shell_args: Current list of shell arguments.
Returns:
- Arguments that need to be appended to the shell argument list.
+ Updated list of shell arguments.
"""
- # Configure a server to serve the checkout root at / (so that Sky examples
- # are accessible using a root-relative path) and Sky packages at /packages.
- # This is independent from the server that potentially serves the origin
- # directory containing the mojo: apps.
- additional_mappings = [
- ('packages/', sky_packages_path),
- ]
- server_url = shell.ServeLocalDirectory(root_path, port=_SKY_SERVER_PORT,
- additional_mappings=additional_mappings)
-
- args = []
# Configure the content type mappings for the sky_viewer. This is needed
- # only for the Sky apps that do not declare mojo:sky_viewer in a shebang,
- # and it is unfortunate as it configures the shell to map all items of the
- # application/dart content-type as Sky apps.
+ # only for the Sky apps that do not declare mojo:sky_viewer in a shebang.
# TODO(ppi): drop this part once we can rely on the Sky files declaring
# correct shebang.
- args = append_to_argument(args, '--content-handlers=',
+ shell_args = append_to_argument(shell_args, '--content-handlers=',
'text/sky,mojo:sky_viewer')
- args = append_to_argument(args, '--content-handlers=',
+ shell_args = append_to_argument(shell_args, '--content-handlers=',
'application/dart,mojo:sky_viewer')
-
- # Configure the window manager to embed the sky_viewer.
- sky_url = server_url + sky_target
- args.append('mojo:window_manager %s' % sky_url)
- return args
+ return shell_args
def configure_local_origin(shell, local_dir, fixed_port=True):
@@ -200,6 +180,9 @@ def add_shell_arguments(parser):
parser.add_argument('--map-origin', action='append',
help='Define a mapping for a url origin in the format '
'<origin>=<url-or-local-file-path>')
+ parser.add_argument('--sky', action='store_true',
+ help='Maps mojo:sky_viewer as the content handler for '
+ 'dart apps.')
parser.add_argument('-v', '--verbose', action="store_true",
help="Increase output verbosity")
@@ -269,4 +252,7 @@ def configure_shell(config_args, shell_args):
shell_args.extend(configure_local_origin(shell, config_args.origin,
fixed_port=True))
+ if config_args.sky:
+ shell_args = _configure_sky(shell_args)
+
return shell, shell_args
« no previous file with comments | « mojo/devtools/common/devtoolslib/paths.py ('k') | mojo/devtools/common/mojo_run » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698