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 exit; | 7 import 'dart:io' show exit; |
8 | 8 |
9 import 'command_line.dart' show CommandLine, argumentError; | 9 import 'command_line.dart' show CommandLine, deprecated_argumentError; |
10 | 10 |
11 import 'compiler_context.dart' show CompilerContext; | 11 import 'compiler_context.dart' show CompilerContext; |
12 | 12 |
13 import 'package:kernel/target/targets.dart' | 13 import 'package:kernel/target/targets.dart' |
14 show Target, getTarget, TargetFlags, targets; | 14 show Target, getTarget, TargetFlags, targets; |
15 | 15 |
16 const Map<String, dynamic> optionSpecification = const <String, dynamic>{ | 16 const Map<String, dynamic> optionSpecification = const <String, dynamic>{ |
17 "--compile-sdk": Uri, | 17 "--compile-sdk": Uri, |
18 "--fatal": ",", | 18 "--fatal": ",", |
19 "--output": Uri, | 19 "--output": Uri, |
(...skipping 27 matching lines...) Expand all Loading... |
47 options.containsKey("/?"); | 47 options.containsKey("/?"); |
48 } | 48 } |
49 | 49 |
50 void validate() { | 50 void validate() { |
51 if (help) { | 51 if (help) { |
52 print(computeUsage(programName, verbose)); | 52 print(computeUsage(programName, verbose)); |
53 exit(0); | 53 exit(0); |
54 } | 54 } |
55 | 55 |
56 if (options.containsKey("-o") && options.containsKey("--output")) { | 56 if (options.containsKey("-o") && options.containsKey("--output")) { |
57 return argumentError(usage, "Can't specify both '-o' and '--output'."); | 57 return deprecated_argumentError( |
| 58 usage, "Can't specify both '-o' and '--output'."); |
58 } | 59 } |
59 if (options.containsKey("-t") && options.containsKey("--target")) { | 60 if (options.containsKey("-t") && options.containsKey("--target")) { |
60 return argumentError(usage, "Can't specify both '-t' and '--target'."); | 61 return deprecated_argumentError( |
| 62 usage, "Can't specify both '-t' and '--target'."); |
61 } | 63 } |
62 if (options.containsKey("--compile-sdk") && | 64 if (options.containsKey("--compile-sdk") && |
63 options.containsKey("--platform")) { | 65 options.containsKey("--platform")) { |
64 return argumentError( | 66 return deprecated_argumentError( |
65 usage, "Can't specify both '--compile-sdk' and '--platform'."); | 67 usage, "Can't specify both '--compile-sdk' and '--platform'."); |
66 } | 68 } |
67 if (programName == "compile_platform" && arguments.length != 3) { | 69 if (programName == "compile_platform" && arguments.length != 3) { |
68 return argumentError(usage, "Expected three arguments."); | 70 return deprecated_argumentError(usage, "Expected three arguments."); |
69 } else if (arguments.isEmpty) { | 71 } else if (arguments.isEmpty) { |
70 return argumentError(usage, "No Dart file specified."); | 72 return deprecated_argumentError(usage, "No Dart file specified."); |
71 } | 73 } |
72 | 74 |
73 Target target = | 75 Target target = |
74 getTarget(targetName, new TargetFlags(strongMode: strongMode)); | 76 getTarget(targetName, new TargetFlags(strongMode: strongMode)); |
75 if (target == null) { | 77 if (target == null) { |
76 return argumentError( | 78 return deprecated_argumentError( |
77 usage, | 79 usage, |
78 "Target '${targetName}' not recognized. " | 80 "Target '${targetName}' not recognized. " |
79 "Valid targets are:\n ${targets.keys.join("\n ")}"); | 81 "Valid targets are:\n ${targets.keys.join("\n ")}"); |
80 } | 82 } |
81 options["target"] = target; | 83 options["target"] = target; |
82 } | 84 } |
83 | 85 |
84 Uri get output { | 86 Uri get output { |
85 return options["-o"] ?? options["--output"] ?? defaultOutput; | 87 return options["-o"] ?? options["--output"] ?? defaultOutput; |
86 } | 88 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 libraries. | 218 libraries. |
217 | 219 |
218 --fatal=errors | 220 --fatal=errors |
219 --fatal=warnings | 221 --fatal=warnings |
220 --fatal=nits | 222 --fatal=nits |
221 Makes messages of the given kinds fatal, that is, immediately stop the | 223 Makes messages of the given kinds fatal, that is, immediately stop the |
222 compiler with a non-zero exit-code. In --verbose mode, also display an | 224 compiler with a non-zero exit-code. In --verbose mode, also display an |
223 internal stack trace from the compiler. Multiple kinds can be separated by | 225 internal stack trace from the compiler. Multiple kinds can be separated by |
224 commas, for example, --fatal=errors,warnings. | 226 commas, for example, --fatal=errors,warnings. |
225 """; | 227 """; |
OLD | NEW |