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

Side by Side Diff: sky/tools/skydb

Issue 1131373005: Have shelldb and skydb automatically download assets for you (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « sky/tools/shelldb ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 '--list', '--short' 51 '--list', '--short'
52 ] 52 ]
53 config = {} 53 config = {}
54 for line in subprocess.check_output(gn_cmd).strip().split('\n'): 54 for line in subprocess.check_output(gn_cmd).strip().split('\n'):
55 # FIXME: This doesn't handle = in values. 55 # FIXME: This doesn't handle = in values.
56 key, value = line.split(' = ') 56 key, value = line.split(' = ')
57 config[key] = value 57 config[key] = value
58 return config 58 return config
59 59
60 60
61 def ensure_assets_are_downloaded(build_dir):
62 sky_pkg_dir = os.path.join(build_dir, 'gen', 'dart-pkg', 'sky')
63 sky_pkg_lib_dir = os.path.join(sky_pkg_dir, 'lib')
64 sky_icons_dir = \
65 os.path.join(sky_pkg_lib_dir, 'assets', 'material-design-icons')
66 if not os.path.isdir(sky_icons_dir):
67 logging.info('NOTE: sky/assets/material-design-icons missing, '
68 'Running `download_material_design_icons` for you.')
69 subprocess.check_call(
70 [os.path.join(sky_pkg_lib_dir, 'download_material_design_icons')])
71
61 class SkyDebugger(object): 72 class SkyDebugger(object):
62 def __init__(self): 73 def __init__(self):
63 self.pids = {} 74 self.pids = {}
64 self.paths = None 75 self.paths = None
65 76
66 def _server_root_for_url(self, url_or_path): 77 def _server_root_for_url(self, url_or_path):
67 path = os.path.abspath(url_or_path) 78 path = os.path.abspath(url_or_path)
68 if os.path.commonprefix([path, SRC_ROOT]) == SRC_ROOT: 79 if os.path.commonprefix([path, SRC_ROOT]) == SRC_ROOT:
69 server_root = SRC_ROOT 80 server_root = SRC_ROOT
70 else: 81 else:
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 def start_command(self, args): 184 def start_command(self, args):
174 # FIXME: Lame that we use self for a command-specific variable. 185 # FIXME: Lame that we use self for a command-specific variable.
175 self.paths = self._create_paths_for_build_dir(args.build_dir) 186 self.paths = self._create_paths_for_build_dir(args.build_dir)
176 self.stop_command(None) # Quit any existing process. 187 self.stop_command(None) # Quit any existing process.
177 188
178 # FIXME: This is probably not the right way to compute is_android 189 # FIXME: This is probably not the right way to compute is_android
179 # from the build directory? 190 # from the build directory?
180 gn_args = gn_args_from_build_dir(self.paths.build_dir) 191 gn_args = gn_args_from_build_dir(self.paths.build_dir)
181 is_android = 'android_sdk_version' in gn_args 192 is_android = 'android_sdk_version' in gn_args
182 193
194 ensure_assets_are_downloaded(args.build_dir)
195
183 shell_found = True 196 shell_found = True
184 if is_android: 197 if is_android:
185 apk_path = os.path.join(self.paths.build_dir, 'apks', ANDROID_APK_NA ME) 198 apk_path = os.path.join(self.paths.build_dir, 'apks', ANDROID_APK_NA ME)
186 if not os.path.exists(apk_path): 199 if not os.path.exists(apk_path):
187 print "%s not found in build_dir '%s'" % \ 200 print "%s not found in build_dir '%s'" % \
188 (ANDROID_APK_NAME, os.path.join(args.build_dir, 'apks')) 201 (ANDROID_APK_NAME, os.path.join(args.build_dir, 'apks'))
189 shell_found = False 202 shell_found = False
190 elif not os.path.exists(self.paths.mojo_shell_path): 203 elif not os.path.exists(self.paths.mojo_shell_path):
191 print "mojo_shell not found in build_dir '%s'" % args.build_dir 204 print "mojo_shell not found in build_dir '%s'" % args.build_dir
192 shell_found = False 205 shell_found = False
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 load_parser.set_defaults(func=self.load_command) 630 load_parser.set_defaults(func=self.load_command)
618 631
619 args = parser.parse_args() 632 args = parser.parse_args()
620 args.func(args) 633 args.func(args)
621 634
622 self._write_pid_file(PID_FILE_PATH, self.pids) 635 self._write_pid_file(PID_FILE_PATH, self.pids)
623 636
624 637
625 if __name__ == '__main__': 638 if __name__ == '__main__':
626 SkyDebugger().main() 639 SkyDebugger().main()
OLDNEW
« no previous file with comments | « sky/tools/shelldb ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698