| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 # We should remove the skypy dependencies from this script. | 9 # We should remove the skypy dependencies from this script. |
| 10 sys.path.append(os.path.abspath(os.path.join(__file__, '../../../sky/tools'))) | 10 sys.path.append(os.path.abspath(os.path.join(__file__, '../../../sky/tools'))) |
| 11 | 11 |
| 12 from skypy.skyserver import SkyServer | 12 from skypy.skyserver import SkyServer |
| 13 import argparse | 13 import argparse |
| 14 import json | 14 import json |
| 15 import logging | 15 import logging |
| 16 import pipes | 16 import pipes |
| 17 import re | 17 import re |
| 18 import requests | 18 import requests |
| 19 import signal | 19 import signal |
| 20 import skypy.paths | 20 import skypy.paths |
| 21 import StringIO | 21 import StringIO |
| 22 import subprocess | 22 import subprocess |
| 23 import time | 23 import time |
| 24 import urlparse | 24 import urlparse |
| 25 import platform | 25 import platform |
| 26 | 26 |
| 27 SUPPORTED_MIME_TYPES = [ | 27 SUPPORTED_MIME_TYPES = [ |
| 28 'text/html', | 28 'text/html', |
| 29 'text/sky', | 29 'text/sky', |
| 30 'text/plain', | 30 'application/dart', |
| 31 ] | 31 ] |
| 32 | 32 |
| 33 DEFAULT_SKY_COMMAND_PORT = 7777 | 33 DEFAULT_SKY_COMMAND_PORT = 7777 |
| 34 GDB_PORT = 8888 | 34 GDB_PORT = 8888 |
| 35 SKY_SERVER_PORT = 9999 | 35 SKY_SERVER_PORT = 9999 |
| 36 DEFAULT_URL = "https://raw.githubusercontent.com/domokit/mojo/master/sky/example
s/home.sky" | 36 DEFAULT_URL = "https://raw.githubusercontent.com/domokit/mojo/master/sky/example
s/home.sky" |
| 37 | 37 |
| 38 ANDROID_PACKAGE = "org.chromium.mojo.shell" | 38 ANDROID_PACKAGE = "org.chromium.mojo.shell" |
| 39 ANDROID_ACTIVITY = "%s/.MojoShellActivity" % ANDROID_PACKAGE | 39 ANDROID_ACTIVITY = "%s/.MojoShellActivity" % ANDROID_PACKAGE |
| 40 ANDROID_APK_NAME = 'MojoShell.apk' | 40 ANDROID_APK_NAME = 'MojoShell.apk' |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 else: | 159 else: |
| 160 shell_command = [self.paths.mojo_shell_path] + shell_args | 160 shell_command = [self.paths.mojo_shell_path] + shell_args |
| 161 | 161 |
| 162 return shell_command | 162 return shell_command |
| 163 | 163 |
| 164 def sky_server_for_args(self, args, packages_root): | 164 def sky_server_for_args(self, args, packages_root): |
| 165 # FIXME: This is a hack. sky_server should just take a build_dir | 165 # FIXME: This is a hack. sky_server should just take a build_dir |
| 166 # not a magical "configuration" name. | 166 # not a magical "configuration" name. |
| 167 configuration = os.path.basename(os.path.normpath(self.paths.build_dir)) | 167 configuration = os.path.basename(os.path.normpath(self.paths.build_dir)) |
| 168 server_root = self._server_root_for_url(args.url_or_path) | 168 server_root = self._server_root_for_url(args.url_or_path) |
| 169 return SkyServer(SKY_SERVER_PORT, configuration, server_root, packages_r
oot) | 169 return SkyServer(SKY_SERVER_PORT, server_root, packages_root) |
| 170 | 170 |
| 171 def _create_paths_for_build_dir(self, build_dir): | 171 def _create_paths_for_build_dir(self, build_dir): |
| 172 # skypy.paths.Paths takes a root-relative build_dir argument. :( | 172 # skypy.paths.Paths takes a root-relative build_dir argument. :( |
| 173 abs_build_dir = os.path.abspath(build_dir) | 173 abs_build_dir = os.path.abspath(build_dir) |
| 174 root_relative_build_dir = os.path.relpath(abs_build_dir, SRC_ROOT) | 174 root_relative_build_dir = os.path.relpath(abs_build_dir, SRC_ROOT) |
| 175 return skypy.paths.Paths(root_relative_build_dir) | 175 return skypy.paths.Paths(root_relative_build_dir) |
| 176 | 176 |
| 177 def _find_remote_pid_for_package(self, package): | 177 def _find_remote_pid_for_package(self, package): |
| 178 ps_output = subprocess.check_output([ADB_PATH, 'shell', 'ps']) | 178 ps_output = subprocess.check_output([ADB_PATH, 'shell', 'ps']) |
| 179 for line in ps_output.split('\n'): | 179 for line in ps_output.split('\n'): |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 load_parser.set_defaults(func=self.load_command) | 642 load_parser.set_defaults(func=self.load_command) |
| 643 | 643 |
| 644 args = parser.parse_args() | 644 args = parser.parse_args() |
| 645 args.func(args) | 645 args.func(args) |
| 646 | 646 |
| 647 self._write_pid_file(PID_FILE_PATH, self.pids) | 647 self._write_pid_file(PID_FILE_PATH, self.pids) |
| 648 | 648 |
| 649 | 649 |
| 650 if __name__ == '__main__': | 650 if __name__ == '__main__': |
| 651 SkyDebugger().main() | 651 SkyDebugger().main() |
| OLD | NEW |