| OLD | NEW |
| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 compiler_cmd.extend(options.vm_flags.split(' ')) | 181 compiler_cmd.extend(options.vm_flags.split(' ')) |
| 182 compiler_cmd.append('--new_gen_heap_size=64'); | 182 compiler_cmd.append('--new_gen_heap_size=64'); |
| 183 compiler_cmd.append(join(HOME, 'frogc.dart')) | 183 compiler_cmd.append(join(HOME, 'frogc.dart')) |
| 184 compiler_cmd.extend(args) | 184 compiler_cmd.extend(args) |
| 185 exit_code = execute(compiler_cmd) | 185 exit_code = execute(compiler_cmd) |
| 186 if exit_code: | 186 if exit_code: |
| 187 if options.verbose: print ("cmd exited with status %d" % exit_code) | 187 if options.verbose: print ("cmd exited with status %d" % exit_code) |
| 188 if cleanup: shutil.rmtree(workdir) | 188 if cleanup: shutil.rmtree(workdir) |
| 189 if exit_code < 0: | 189 if exit_code < 0: |
| 190 print("VM exited with signal %d" % (-exit_code)) | 190 print("VM exited with signal %d" % (-exit_code)) |
| 191 # TODO(ahe): Using 253 to signal a crash to test.dart. |
| 192 return 253 |
| 191 return exit_code | 193 return exit_code |
| 192 | 194 |
| 193 result = 0 | 195 result = 0 |
| 194 if not outfile_given: | 196 if not outfile_given: |
| 195 if not options.html: | 197 if not options.html: |
| 196 js_cmd = options.js_cmd | 198 js_cmd = options.js_cmd |
| 197 result = execute(js_cmd.split(' ') + [outfile] + nodeArgs) | 199 result = execute(js_cmd.split(' ') + [outfile] + nodeArgs) |
| 198 else: | 200 else: |
| 199 f = open(outhtml, 'w') | 201 f = open(outhtml, 'w') |
| 200 f.write(HTML) | 202 f.write(HTML) |
| 201 f.close() | 203 f.close() |
| 202 result = execute([browser, outhtml]) | 204 result = execute([browser, outhtml]) |
| 203 else: | 205 else: |
| 204 print 'Compilation succeded. Code generated in: %s' % outfile | 206 print 'Compilation succeded. Code generated in: %s' % outfile |
| 205 | 207 |
| 206 if cleanup: shutil.rmtree(workdir) | 208 if cleanup: shutil.rmtree(workdir) |
| 207 if result != 0: | 209 if result != 0: |
| 208 return 1 | 210 return 1 |
| 209 return 0 | 211 return 0 |
| 210 | 212 |
| 211 if __name__ == '__main__': | 213 if __name__ == '__main__': |
| 212 sys.exit(main(sys.argv)) | 214 sys.exit(main(sys.argv)) |
| OLD | NEW |