| Index: mojo/devtools/common/mojo_shell
|
| diff --git a/mojo/devtools/common/mojo_shell b/mojo/devtools/common/mojo_shell
|
| deleted file mode 100755
|
| index 38b6219ca2c68592d6d4646cdacc2b6279fe999c..0000000000000000000000000000000000000000
|
| --- a/mojo/devtools/common/mojo_shell
|
| +++ /dev/null
|
| @@ -1,148 +0,0 @@
|
| -#!/usr/bin/env python
|
| -# Copyright 2014 The Chromium Authors. All rights reserved.
|
| -# Use of this source code is governed by a BSD-style license that can be
|
| -# found in the LICENSE file.
|
| -
|
| -import argparse
|
| -import logging
|
| -import sys
|
| -
|
| -from devtoolslib.android_shell import AndroidShell
|
| -from devtoolslib.linux_shell import LinuxShell
|
| -from devtoolslib import paths
|
| -from devtoolslib import shell_arguments
|
| -
|
| -USAGE = ("mojo_shell "
|
| - "[--args-for=<mojo-app>] "
|
| - "[--content-handlers=<handlers>] "
|
| - "[--enable-external-applications] "
|
| - "[--disable-cache] "
|
| - "[--enable-multiprocess] "
|
| - "[--url-mappings=from1=to1,from2=to2] "
|
| - "[<mojo-app>] "
|
| - """
|
| -
|
| -A <mojo-app> is a Mojo URL or a Mojo URL and arguments within quotes.
|
| -Example: mojo_shell "mojo:js_standalone test.js".
|
| -<url-lib-path> is searched for shared libraries named by mojo URLs.
|
| -The value of <handlers> is a comma separated list like:
|
| -text/html,mojo:html_viewer,application/javascript,mojo:js_content_handler
|
| -""")
|
| -
|
| -_DEFAULT_WINDOW_MANAGER = "mojo:kiosk_wm"
|
| -
|
| -
|
| -def main():
|
| - logging.basicConfig()
|
| -
|
| - parser = argparse.ArgumentParser(usage=USAGE)
|
| -
|
| - # Arguments indicating the configuration we are targeting.
|
| - parser.add_argument('--android', help='Run on Android',
|
| - action='store_true')
|
| - debug_group = parser.add_mutually_exclusive_group()
|
| - debug_group.add_argument('--debug', help='Debug build (default)',
|
| - default=True, action='store_true')
|
| - debug_group.add_argument('--release', help='Release build', default=False,
|
| - dest='debug', action='store_false')
|
| - parser.add_argument('--target-cpu', help='CPU architecture to run for.',
|
| - choices=['x64', 'x86', 'arm'])
|
| -
|
| - # Arguments configuring the shell run.
|
| - parser.add_argument('--origin', help='Origin for mojo: URLs.')
|
| - parser.add_argument('--window-manager', default=_DEFAULT_WINDOW_MANAGER,
|
| - help='Window manager app to be mapped as '
|
| - 'mojo:window_manager. By default it is ' +
|
| - _DEFAULT_WINDOW_MANAGER)
|
| - parser.add_argument('--no-debugger', action="store_true",
|
| - help='Do not spawn mojo:debugger.')
|
| - parser.add_argument('--sky',
|
| - help='Loads the given Sky file.')
|
| - parser.add_argument('-v', '--verbose', action="store_true",
|
| - help="Increase output verbosity")
|
| -
|
| - # Android-only arguments.
|
| - parser.add_argument('--target-device',
|
| - help='(android-only) Device to run on.')
|
| - parser.add_argument('--logcat-tags',
|
| - help='(android-only) Comma-separated list of additional '
|
| - 'logcat tags to display on the console.')
|
| -
|
| - # Desktop-only arguments.
|
| - parser.add_argument('--use-osmesa', action='store_true',
|
| - help='(linux-only) Configure the native viewport service '
|
| - 'for off-screen rendering.')
|
| -
|
| - launcher_args, args = parser.parse_known_args()
|
| - mojo_paths, _ = paths.infer_mojo_paths(launcher_args.android,
|
| - launcher_args.debug,
|
| - launcher_args.target_cpu)
|
| - if mojo_paths:
|
| - adb_path = mojo_paths['adb']
|
| - shell_binary_path = mojo_paths['shell']
|
| - local_origin_path = mojo_paths['build']
|
| - if launcher_args.verbose:
|
| - print 'Running within a Mojo checkout:'
|
| - print ' - using the locally built shell at ' + shell_binary_path
|
| - print ' - using the default origin of ' + local_origin_path
|
| - else:
|
| - if launcher_args.android:
|
| - adb_path = 'adb'
|
| - shell_binary_path = None
|
| - local_origin_path = '.'
|
| - if launcher_args.verbose:
|
| - print 'Running outside a Mojo checkout:'
|
| - print ' - using the shell already installed on the device'
|
| - print ' - using the current working directory as default origin'
|
| - else:
|
| - print 'Running outside a Mojo checkout is not supported on Linux yet.'
|
| - return 1
|
| -
|
| - if launcher_args.android:
|
| - verbose_pipe = sys.stdout if launcher_args.verbose else None
|
| -
|
| - shell = AndroidShell(adb_path, 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
|
| - if shell_binary_path:
|
| - shell.InstallApk(shell_binary_path)
|
| -
|
| - args = shell_arguments.RewriteMapOriginParameters(shell, args)
|
| - if not launcher_args.origin:
|
| - args.extend(shell_arguments.ConfigureLocalOrigin(shell,
|
| - local_origin_path))
|
| - else:
|
| - shell = LinuxShell(shell_binary_path)
|
| - if launcher_args.use_osmesa:
|
| - args.append('--args-for=mojo:native_viewport_service --use-osmesa')
|
| -
|
| - if launcher_args.origin:
|
| - args.append('--origin=' + launcher_args.origin)
|
| - args = shell_arguments.AppendToArgument(args, '--url-mappings=',
|
| - 'mojo:window_manager=%s' %
|
| - launcher_args.window_manager)
|
| - if not launcher_args.no_debugger:
|
| - args.extend(shell_arguments.ConfigureDebugger(shell))
|
| -
|
| - if launcher_args.sky:
|
| - if not mojo_paths:
|
| - print 'Running with --sky is not supported outside of the Mojo checkout.'
|
| - # See https://github.com/domokit/devtools/issues/27.
|
| - return 1
|
| - args.extend(shell_arguments.ConfigureSky(shell, mojo_paths['root'],
|
| - mojo_paths['sky_packages'],
|
| - launcher_args.sky))
|
| -
|
| - if launcher_args.verbose:
|
| - print "Shell arguments: " + str(args)
|
| -
|
| - shell.Run(args)
|
| - return 0
|
| -
|
| -
|
| -if __name__ == "__main__":
|
| - sys.exit(main())
|
|
|