OLD | NEW |
1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2016, 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 @JS() | 6 @JS() |
7 library dev_compiler.web.main; | 7 library dev_compiler.web.main; |
8 | 8 |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 | 10 |
11 import 'package:args/command_runner.dart'; | 11 import 'package:args/command_runner.dart'; |
12 import 'package:js/js.dart'; | 12 import 'package:js/js.dart'; |
13 | 13 |
14 import 'web_command.dart'; | 14 import 'web_command.dart'; |
15 | 15 |
16 @JS(r'$setUpDartDevCompilerInBrowser') | 16 @JS(r'$setUpDartDevCompilerInBrowser') |
17 external set setUpCompilerInBrowser(Function function); | 17 external set setUpCompilerInBrowser(Function function); |
18 | 18 |
19 Future main() async { | 19 Future main() async { |
20 var args = ['compile']; | 20 var args = ['compile', '--repl-compile']; |
21 _runCommand(args); | 21 _runCommand(args); |
22 } | 22 } |
23 | 23 |
24 /// Runs a single compile command, and returns an exit code. | 24 /// Runs a single compile command, and returns an exit code. |
25 Future<int> _runCommand(List<String> args, | 25 Future<int> _runCommand(List<String> args, |
26 {MessageHandler messageHandler}) async { | 26 {MessageHandler messageHandler}) async { |
27 try { | 27 try { |
28 // TODO: Remove CommandRunner and args if possible. May run into issues | 28 // TODO: Remove CommandRunner and args if possible. May run into issues |
29 // with ArgResults or ArgParsers. | 29 // with ArgResults or ArgParsers. |
30 var runner = new CommandRunner('dartdevc', 'Dart Development Compiler'); | 30 var runner = new CommandRunner('dartdevc', 'Dart Development Compiler'); |
(...skipping 23 matching lines...) Expand all Loading... |
54 // Anything else is likely a compiler bug. | 54 // Anything else is likely a compiler bug. |
55 // | 55 // |
56 // --unsafe-force-compile is a bit of a grey area, but it's nice not to | 56 // --unsafe-force-compile is a bit of a grey area, but it's nice not to |
57 // crash while compiling | 57 // crash while compiling |
58 // (of course, output code may crash, if it had errors). | 58 // (of course, output code may crash, if it had errors). |
59 // | 59 // |
60 messageHandler(""); | 60 messageHandler(""); |
61 messageHandler("We're sorry, you've found a bug in our compiler."); | 61 messageHandler("We're sorry, you've found a bug in our compiler."); |
62 messageHandler("You can report this bug at:"); | 62 messageHandler("You can report this bug at:"); |
63 messageHandler( | 63 messageHandler( |
64 " https://github.com/dart-lang/sdk/issues/labels/area-dev-compiler"); | 64 " https://github.com/dart-lang/sdk/issues/labels/area-dev-compiler"); |
65 messageHandler(""); | 65 messageHandler(""); |
66 messageHandler( | 66 messageHandler( |
67 "Please include the information below in your report, along with"); | 67 "Please include the information below in your report, along with"); |
68 messageHandler( | 68 messageHandler( |
69 "any other information that may help us track it down. Thanks!"); | 69 "any other information that may help us track it down. Thanks!"); |
70 messageHandler(""); | 70 messageHandler(""); |
71 messageHandler(" dartdevc arguments: " + args.join(' ')); | 71 messageHandler(" dartdevc arguments: " + args.join(' ')); |
72 messageHandler(""); | 72 messageHandler(""); |
73 messageHandler("```"); | 73 messageHandler("```"); |
74 messageHandler(error); | 74 messageHandler(error); |
75 messageHandler(stackTrace); | 75 messageHandler(stackTrace); |
76 messageHandler("```"); | 76 messageHandler("```"); |
77 return 70; | 77 return 70; |
78 } | 78 } |
79 } | 79 } |
OLD | NEW |