| Index: mojo/devtools/common/mojo_shell
|
| diff --git a/mojo/tools/mojo_shell.py b/mojo/devtools/common/mojo_shell
|
| similarity index 85%
|
| copy from mojo/tools/mojo_shell.py
|
| copy to mojo/devtools/common/mojo_shell
|
| index 4c303d9ed04cc32bc6a6cabc8ff7f131eb42bd7d..517b38e95d0abe2f2156fcd64499b58d062db394 100755
|
| --- a/mojo/tools/mojo_shell.py
|
| +++ b/mojo/devtools/common/mojo_shell
|
| @@ -6,19 +6,13 @@
|
| import argparse
|
| import logging
|
| import sys
|
| -import os.path
|
| -import subprocess
|
|
|
| -import devtools
|
| -devtools.add_lib_to_path()
|
| from devtoolslib.android_shell import AndroidShell
|
| from devtoolslib.linux_shell import LinuxShell
|
| from devtoolslib import shell_arguments
|
| +from devtoolslib import default_paths
|
|
|
| -from mopy.config import Config
|
| -from mopy.paths import Paths
|
| -
|
| -USAGE = ("mojo_shell.py "
|
| +USAGE = ("mojo_shell "
|
| "[--args-for=<mojo-app>] "
|
| "[--content-handlers=<handlers>] "
|
| "[--enable-external-applications] "
|
| @@ -81,31 +75,30 @@ def main():
|
| 'for off-screen rendering.')
|
|
|
| launcher_args, args = parser.parse_known_args()
|
| + paths, error_msg = default_paths.infer_default_paths(launcher_args.android,
|
| + launcher_args.debug,
|
| + launcher_args.target_cpu)
|
| + if not paths:
|
| + print error_msg
|
| + return -1
|
| +
|
| if launcher_args.android:
|
| - config = Config(target_os=Config.OS_ANDROID,
|
| - target_cpu=launcher_args.target_cpu,
|
| - is_debug=launcher_args.debug)
|
| - paths = Paths(config)
|
| verbose_pipe = sys.stdout if launcher_args.verbose else None
|
|
|
| - shell = AndroidShell(paths.adb_path, launcher_args.target_device,
|
| + shell = AndroidShell(paths['adb'], launcher_args.target_device,
|
| logcat_tags=launcher_args.logcat_tags,
|
| verbose_pipe=verbose_pipe)
|
| device_status, error = shell.CheckDevice()
|
| if not device_status:
|
| print 'Device check failed: ' + error
|
| return 1
|
| - shell.InstallApk(paths.target_mojo_shell_path)
|
| + shell.InstallApk(paths['shell'])
|
|
|
| args = shell_arguments.RewriteMapOriginParameters(shell, args)
|
| if not launcher_args.origin:
|
| - args.extend(shell_arguments.ConfigureLocalOrigin(shell, paths.build_dir))
|
| + args.extend(shell_arguments.ConfigureLocalOrigin(shell, paths['build']))
|
| else:
|
| - config = Config(target_os=Config.OS_LINUX,
|
| - target_cpu=launcher_args.target_cpu,
|
| - is_debug=launcher_args.debug)
|
| - paths = Paths(config)
|
| - shell = LinuxShell(paths.mojo_shell_path)
|
| + shell = LinuxShell(paths['shell'])
|
| if launcher_args.use_osmesa:
|
| args.append('--args-for=mojo:native_viewport_service --use-osmesa')
|
|
|
| @@ -122,12 +115,10 @@ def main():
|
| # 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.
|
| - packages_local_path = os.path.join(paths.build_dir, 'gen', 'dart-pkg',
|
| - 'packages')
|
| additional_mappings = [
|
| - ('packages/', packages_local_path),
|
| + ('packages/', paths['sky_packages']),
|
| ]
|
| - server_url = shell.ServeLocalDirectory(paths.src_root,
|
| + server_url = shell.ServeLocalDirectory(paths['root'],
|
| port=_SKY_SERVER_PORT, additional_mappings=additional_mappings)
|
|
|
| # Configure the content type mappings for the sky_viewer. This is needed
|
|
|