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

Unified Diff: mojo/devtools/common/mojo_shell

Issue 1242453003: Extract the shell runner into devtools. (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
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..f78c3ac848a0251b2ff6ee68eba277590cf4249a 100755
--- a/mojo/tools/mojo_shell.py
+++ b/mojo/devtools/common/mojo_shell
@@ -6,17 +6,11 @@
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 mopy.config import Config
-from mopy.paths import Paths
+from devtoolslib import default_paths
USAGE = ("mojo_shell.py "
"[--args-for=<mojo-app>] "
@@ -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

Powered by Google App Engine
This is Rietveld 408576698