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 89d66e41ce8075bd389215b9469359030034620d..bd1375554b5ca44edf00d196b3254e64ac86488d 100644 |
--- a/mojo/devtools/common/devtoolslib/shell_arguments.py |
+++ b/mojo/devtools/common/devtoolslib/shell_arguments.py |
@@ -14,6 +14,7 @@ import urlparse |
from devtoolslib.android_shell import AndroidShell |
from devtoolslib.linux_shell import LinuxShell |
+from devtoolslib.shell_config import ShellConfigurationException |
# When spinning up servers for local origins, we want to use predictable ports |
# so that caching works between subsequent runs with the same command line. |
@@ -21,11 +22,6 @@ _LOCAL_ORIGIN_PORT = 31840 |
_MAPPINGS_BASE_PORT = 31841 |
-class ShellConfigurationException(Exception): |
- """Represents an error preventing creating a functional shell abstraction.""" |
- pass |
- |
- |
def _is_web_url(dest): |
return True if urlparse.urlparse(dest).scheme else False |
@@ -170,6 +166,26 @@ def append_to_argument(arguments, key, value, delimiter=","): |
return arguments |
+def _configure_dev_server(shell, shell_args, dev_server_config): |
+ """Sets up a dev server on the host according to |dev_server_config|. |
+ |
+ Args: |
+ shell: The shell that is being configured. |
+ shell_arguments: Current list of shell arguments. |
+ dev_server_config: Instance of shell_config.DevServerConfig describing the |
+ dev server to be set up. |
+ |
+ Returns: |
+ The updated argument list. |
+ """ |
+ server_url = shell.serve_local_directories(dev_server_config.mappings) |
+ shell_args.append('--map-origin=%s=%s' % (dev_server_config.host, server_url)) |
+ print "Configured %s locally as %s" % (dev_server_config.host, server_url) |
+ for mapping_prefix, mapping_path in dev_server_config.mappings: |
+ print " /%s -> %s" % (mapping_prefix, mapping_path) |
+ return shell_args |
qsr
2015/08/05 08:11:13
Why do you both update the reference you are given
ppi
2015/08/05 10:54:01
This matches what all other functions do. I'm happ
|
+ |
+ |
def get_shell(shell_config, shell_args): |
""" |
Produces a shell abstraction configured according to |shell_config|. |
@@ -221,4 +237,7 @@ def get_shell(shell_config, shell_args): |
if shell_config.sky: |
shell_args = _configure_sky(shell_args) |
+ for dev_server_config in shell_config.dev_servers: |
+ shell_args = _configure_dev_server(shell, shell_args, dev_server_config) |
+ |
return shell, shell_args |