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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 void validate() { | 45 void validate() { |
46 if (help) { | 46 if (help) { |
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")) { | |
55 return argumentError(usage, "Option '--packages' isn't supported yet."); | |
56 } | |
57 if (programName == "compile_platform" && arguments.length != 2) { | 54 if (programName == "compile_platform" && arguments.length != 2) { |
58 return argumentError(usage, "Expected two arguments."); | 55 return argumentError(usage, "Expected two arguments."); |
59 } else if (arguments.isEmpty) { | 56 } else if (arguments.isEmpty) { |
60 return argumentError(usage, "No Dart file specified."); | 57 return argumentError(usage, "No Dart file specified."); |
61 } | 58 } |
62 } | 59 } |
63 | 60 |
64 Uri get output { | 61 Uri get output { |
65 return options["-o"] ?? options["--output"] ?? defaultOutput; | 62 return options["-o"] ?? options["--output"] ?? defaultOutput; |
66 } | 63 } |
67 | 64 |
68 Uri get defaultOutput => Uri.base.resolve("${arguments.first}.dill"); | 65 Uri get defaultOutput => Uri.base.resolve("${arguments.first}.dill"); |
69 | 66 |
70 Uri get platform { | 67 Uri get platform { |
71 return options.containsKey("--compile-sdk") | 68 return options.containsKey("--compile-sdk") |
72 ? null | 69 ? null |
73 : options["--platform"] ?? Uri.base.resolve("platform.dill"); | 70 : options["--platform"] ?? Uri.base.resolve("platform.dill"); |
74 } | 71 } |
75 | 72 |
| 73 Uri get packages => options["--packages"] ?? Uri.base.resolve(".packages"); |
| 74 |
76 Uri get sdk => options["--compile-sdk"]; | 75 Uri get sdk => options["--compile-sdk"]; |
77 | 76 |
78 Set<String> get fatal { | 77 Set<String> get fatal { |
79 return new Set<String>.from(options["--fatal"] ?? <String>[]); | 78 return new Set<String>.from(options["--fatal"] ?? <String>[]); |
80 } | 79 } |
81 | 80 |
82 bool get errorsAreFatal => fatal.contains("errors"); | 81 bool get errorsAreFatal => fatal.contains("errors"); |
83 | 82 |
84 bool get warningsAreFatal => fatal.contains("warnings"); | 83 bool get warningsAreFatal => fatal.contains("warnings"); |
85 | 84 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 Compile the SDK from scratch instead of reading it from 'platform.dill'. | 175 Compile the SDK from scratch instead of reading it from 'platform.dill'. |
177 | 176 |
178 --fatal=errors | 177 --fatal=errors |
179 --fatal=warnings | 178 --fatal=warnings |
180 --fatal=nits | 179 --fatal=nits |
181 Makes messages of the given kinds fatal, that is, immediately stop the | 180 Makes messages of the given kinds fatal, that is, immediately stop the |
182 compiler with a non-zero exit-code. In --verbose mode, also display an | 181 compiler with a non-zero exit-code. In --verbose mode, also display an |
183 internal stack trace from the compiler. Multiple kinds can be separated by | 182 internal stack trace from the compiler. Multiple kinds can be separated by |
184 commas, for example, --fatal=errors,warnings. | 183 commas, for example, --fatal=errors,warnings. |
185 """; | 184 """; |
OLD | NEW |