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

Side by Side Diff: frog/frog.py

Issue 9967022: make configurations like frog-none do the right thing: call frog, but don't (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/testing/dart/test_suite.dart » ('j') | 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 (c) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """Command line wrapper to run the frog compiler under the Dart VM""" 6 """Command line wrapper to run the frog compiler under the Dart VM"""
7 7
8 # TODO(jimhug): This is a temporary hack to enable running on the VM. We need 8 # TODO(jimhug): This is a temporary hack to enable running on the VM. We need
9 # the ability to get command-line arguments, to return exit codes, and to 9 # the ability to get command-line arguments, to return exit codes, and to
10 # communicate with spawned processes in the VM for this to go away. 10 # communicate with spawned processes in the VM for this to go away.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 def compileAndRun(options, args, dart): 140 def compileAndRun(options, args, dart):
141 nodeArgs = [] 141 nodeArgs = []
142 for i in range(len(args)): 142 for i in range(len(args)):
143 if args[i].endswith('.dart'): 143 if args[i].endswith('.dart'):
144 nodeArgs = args[i+1:] 144 nodeArgs = args[i+1:]
145 args = args[:i+1] 145 args = args[:i+1]
146 break 146 break
147 147
148 outfile_given = False 148 outfile_given = False
149 execute_output = True
149 for i in range(len(args)): 150 for i in range(len(args)):
150 if args[i].startswith('--out'): 151 if args[i].startswith('--out'):
151 outfile_given = True 152 outfile_given = True
152 outfile = args[i][6:] 153 outfile = args[i][6:]
154 execute_output = False
155 break;
156 if args[i] == '--compile-only':
157 execute_output = False
153 break; 158 break;
154 159
155 if options.verbose: print "nodeArgs %s" % ' '.join(nodeArgs); 160 if options.verbose: print "nodeArgs %s" % ' '.join(nodeArgs);
156 161
157 workdir = options.workdir 162 workdir = options.workdir
158 cleanup = False 163 cleanup = False
159 if not workdir: 164 if not workdir:
160 if not options.html: 165 if not options.html:
161 workdir = tempfile.mkdtemp() 166 workdir = tempfile.mkdtemp()
162 if not options.keep_files: 167 if not options.keep_files:
(...skipping 30 matching lines...) Expand all
193 if exit_code: 198 if exit_code:
194 if options.verbose: print ("cmd exited with status %d" % exit_code) 199 if options.verbose: print ("cmd exited with status %d" % exit_code)
195 if cleanup: shutil.rmtree(workdir) 200 if cleanup: shutil.rmtree(workdir)
196 if exit_code < 0: 201 if exit_code < 0:
197 print("VM exited with signal %d" % (-exit_code)) 202 print("VM exited with signal %d" % (-exit_code))
198 # TODO(ahe): Using 253 to signal a crash to test.dart. 203 # TODO(ahe): Using 253 to signal a crash to test.dart.
199 return 253 204 return 253
200 return exit_code 205 return exit_code
201 206
202 result = 0 207 result = 0
203 if not outfile_given: 208 if execute_output:
204 if not options.html: 209 if not options.html:
205 if ensureJsEngine(options) != 0: 210 if ensureJsEngine(options) != 0:
206 return 1 211 return 1
207 js_cmd = options.js_cmd 212 js_cmd = options.js_cmd
208 result = execute(js_cmd.split(' ') + [outfile] + nodeArgs) 213 result = execute(js_cmd.split(' ') + [outfile] + nodeArgs)
209 else: 214 else:
210 f = open(outhtml, 'w') 215 f = open(outhtml, 'w')
211 f.write(HTML) 216 f.write(HTML)
212 f.close() 217 f.close()
213 result = execute([browser, outhtml]) 218 result = execute([browser, outhtml])
219 elif outfile_given:
220 print 'Compilation succeded. Code generated in: %s' % outfile
214 else: 221 else:
215 print 'Compilation succeded. Code generated in: %s' % outfile 222 print 'Compilation succeded.'
216 223
217 if cleanup: shutil.rmtree(workdir) 224 if cleanup: shutil.rmtree(workdir)
218 if result != 0: 225 if result != 0:
219 return 1 226 return 1
220 return 0 227 return 0
221 228
222 if __name__ == '__main__': 229 if __name__ == '__main__':
223 sys.exit(main(sys.argv)) 230 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698