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

Side by Side Diff: sky/tools/skydb

Issue 990493002: Make package: work like Dart expects in preparation for a Sky SDK (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Works Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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 from skypy.skyserver import SkyServer 6 from skypy.skyserver import SkyServer
7 import argparse 7 import argparse
8 import json 8 import json
9 import logging 9 import logging
10 import os 10 import os
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 if is_android and args.gdb: 132 if is_android and args.gdb:
133 shell_args.append('--wait-for-debugger') 133 shell_args.append('--wait-for-debugger')
134 134
135 if 'remote_sky_server_port' in self.pids: 135 if 'remote_sky_server_port' in self.pids:
136 shell_command = self._wrap_for_android(shell_args) 136 shell_command = self._wrap_for_android(shell_args)
137 else: 137 else:
138 shell_command = [self.paths.mojo_shell_path] + shell_args 138 shell_command = [self.paths.mojo_shell_path] + shell_args
139 139
140 return shell_command 140 return shell_command
141 141
142 def sky_server_for_args(self, args): 142 def sky_server_for_args(self, args, packages_root):
143 # FIXME: This is a hack. sky_server should just take a build_dir 143 # FIXME: This is a hack. sky_server should just take a build_dir
144 # not a magical "configuration" name. 144 # not a magical "configuration" name.
145 configuration = os.path.basename(os.path.normpath(self.paths.build_dir)) 145 configuration = os.path.basename(os.path.normpath(self.paths.build_dir))
146 server_root = self._server_root_for_url(args.url_or_path) 146 server_root = self._server_root_for_url(args.url_or_path)
147 sky_server = SkyServer(SKY_SERVER_PORT, configuration, server_root) 147 return SkyServer(SKY_SERVER_PORT, configuration, server_root, packages_r oot)
148 return sky_server
149 148
150 def _create_paths_for_build_dir(self, build_dir): 149 def _create_paths_for_build_dir(self, build_dir):
151 # skypy.paths.Paths takes a root-relative build_dir argument. :( 150 # skypy.paths.Paths takes a root-relative build_dir argument. :(
152 abs_build_dir = os.path.abspath(build_dir) 151 abs_build_dir = os.path.abspath(build_dir)
153 root_relative_build_dir = os.path.relpath(abs_build_dir, SRC_ROOT) 152 root_relative_build_dir = os.path.relpath(abs_build_dir, SRC_ROOT)
154 return skypy.paths.Paths(root_relative_build_dir) 153 return skypy.paths.Paths(root_relative_build_dir)
155 154
156 def _find_remote_pid_for_package(self, package): 155 def _find_remote_pid_for_package(self, package):
157 ps_output = subprocess.check_output([ADB_PATH, 'shell', 'ps']) 156 ps_output = subprocess.check_output([ADB_PATH, 'shell', 'ps'])
158 for line in ps_output.split('\n'): 157 for line in ps_output.split('\n'):
(...skipping 22 matching lines...) Expand all
181 # FIXME: This is probably not the right way to compute is_android 180 # FIXME: This is probably not the right way to compute is_android
182 # from the build directory? 181 # from the build directory?
183 gn_args = gn_args_from_build_dir(self.paths.build_dir) 182 gn_args = gn_args_from_build_dir(self.paths.build_dir)
184 is_android = 'android_sdk_version' in gn_args 183 is_android = 'android_sdk_version' in gn_args
185 184
186 if is_android and args.gdb and not 'is_debug' in gn_args: 185 if is_android and args.gdb and not 'is_debug' in gn_args:
187 # FIXME: We don't include gdbserver in the release APK... 186 # FIXME: We don't include gdbserver in the release APK...
188 print "Cannot debug Release builds on Android" 187 print "Cannot debug Release builds on Android"
189 sys.exit(2) 188 sys.exit(2)
190 189
191 sky_server = self.sky_server_for_args(args) 190 sdk_root = os.path.join(self.paths.build_dir, 'gen', 'sky_sdk')
191 packages_root = os.path.join(sdk_root, 'packages_root')
192 subprocess.check_call([
193 os.path.join(self.paths.sky_tools_directory, 'deploy_sdk.py'),
194 '--force',
195 '--skip-apks',
196 '--fake-pub-get-into', packages_root,
197 sdk_root,
198 ])
199
200 sky_server = self.sky_server_for_args(args, packages_root)
192 self.pids['sky_server_pid'] = sky_server.start() 201 self.pids['sky_server_pid'] = sky_server.start()
193 self.pids['sky_server_port'] = sky_server.port 202 self.pids['sky_server_port'] = sky_server.port
194 self.pids['sky_server_root'] = sky_server.root 203 self.pids['sky_server_root'] = sky_server.root
195 204
196 self.pids['build_dir'] = self.paths.build_dir 205 self.pids['build_dir'] = self.paths.build_dir
197 self.pids['sky_command_port'] = args.command_port 206 self.pids['sky_command_port'] = args.command_port
198 207
199 if is_android: 208 if is_android:
200 # TODO(eseidel): This should move into a helper method and handle 209 # TODO(eseidel): This should move into a helper method and handle
201 # failures with nice messages explaining how to get root. 210 # failures with nice messages explaining how to get root.
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 load_parser.set_defaults(func=self.load_command) 608 load_parser.set_defaults(func=self.load_command)
600 609
601 args = parser.parse_args() 610 args = parser.parse_args()
602 args.func(args) 611 args.func(args)
603 612
604 self._write_pid_file(PID_FILE_PATH, self.pids) 613 self._write_pid_file(PID_FILE_PATH, self.pids)
605 614
606 615
607 if __name__ == '__main__': 616 if __name__ == '__main__':
608 SkyDebugger().main() 617 SkyDebugger().main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698