| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library fasta.compiler_command_line; | 5 library fasta.compiler_command_line; |
| 6 | 6 |
| 7 import 'dart:io' show | 7 import 'dart:io' show |
| 8 exit; | 8 exit; |
| 9 | 9 |
| 10 import 'command_line.dart' show | 10 import 'command_line.dart' show |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 print(computeUsage(programName, verbose)); | 47 print(computeUsage(programName, verbose)); |
| 48 exit(0); | 48 exit(0); |
| 49 } | 49 } |
| 50 | 50 |
| 51 if (options.containsKey("-o") && options.containsKey("--output")) { | 51 if (options.containsKey("-o") && options.containsKey("--output")) { |
| 52 return argumentError(usage, "Can't specify both '-o' and '--output'."); | 52 return argumentError(usage, "Can't specify both '-o' and '--output'."); |
| 53 } | 53 } |
| 54 if (options.containsKey("--packages")) { | 54 if (options.containsKey("--packages")) { |
| 55 return argumentError(usage, "Option '--packages' isn't supported yet."); | 55 return argumentError(usage, "Option '--packages' isn't supported yet."); |
| 56 } | 56 } |
| 57 if (arguments.isEmpty) { | 57 if (programName == "compile_platform" && arguments.length != 2) { |
| 58 return argumentError(usage, "Expected two arguments."); |
| 59 } else if (arguments.isEmpty) { |
| 58 return argumentError(usage, "No Dart file specified."); | 60 return argumentError(usage, "No Dart file specified."); |
| 59 } | 61 } |
| 60 } | 62 } |
| 61 | 63 |
| 62 Uri get output { | 64 Uri get output { |
| 63 return options["-o"] ?? options["--output"] ?? defaultOutput; | 65 return options["-o"] ?? options["--output"] ?? defaultOutput; |
| 64 } | 66 } |
| 65 | 67 |
| 66 Uri get defaultOutput => Uri.base.resolve("${arguments.first}.dill"); | 68 Uri get defaultOutput => Uri.base.resolve("${arguments.first}.dill"); |
| 67 | 69 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 break; | 111 break; |
| 110 | 112 |
| 111 case "kompile": | 113 case "kompile": |
| 112 summary = | 114 summary = |
| 113 "Compiles a Dart program to the Dill/Kernel IR format via dartk."; | 115 "Compiles a Dart program to the Dill/Kernel IR format via dartk."; |
| 114 break; | 116 break; |
| 115 | 117 |
| 116 case "run": | 118 case "run": |
| 117 summary = "Runs a Dart program."; | 119 summary = "Runs a Dart program."; |
| 118 break; | 120 break; |
| 121 |
| 122 case "compile_platform": |
| 123 summary = |
| 124 "Compiles Dart SDK platform to the Dill/Kernel IR format."; |
| 125 basicUsage = "Usage: $programName [options] patched_sdk output\n"; |
| 119 } | 126 } |
| 120 StringBuffer sb = new StringBuffer(basicUsage); | 127 StringBuffer sb = new StringBuffer(basicUsage); |
| 121 if (summary != null) { | 128 if (summary != null) { |
| 122 sb.writeln(); | 129 sb.writeln(); |
| 123 sb.writeln(summary); | 130 sb.writeln(summary); |
| 124 sb.writeln(); | 131 sb.writeln(); |
| 125 } | 132 } |
| 126 sb.write(options); | 133 sb.write(options); |
| 127 return "$sb"; | 134 return "$sb"; |
| 128 } | 135 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 Compile the SDK from scratch instead of reading it from 'platform.dill'. | 176 Compile the SDK from scratch instead of reading it from 'platform.dill'. |
| 170 | 177 |
| 171 --fatal=errors | 178 --fatal=errors |
| 172 --fatal=warnings | 179 --fatal=warnings |
| 173 --fatal=nits | 180 --fatal=nits |
| 174 Makes messages of the given kinds fatal, that is, immediately stop the | 181 Makes messages of the given kinds fatal, that is, immediately stop the |
| 175 compiler with a non-zero exit-code. In --verbose mode, also display an | 182 compiler with a non-zero exit-code. In --verbose mode, also display an |
| 176 internal stack trace from the compiler. Multiple kinds can be separated by | 183 internal stack trace from the compiler. Multiple kinds can be separated by |
| 177 commas, for example, --fatal=errors,warnings. | 184 commas, for example, --fatal=errors,warnings. |
| 178 """; | 185 """; |
| OLD | NEW |