| 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 |
| 11 CommandLine, | 11 CommandLine, |
| 12 argumentError; | 12 argumentError; |
| 13 | 13 |
| 14 import 'compiler_context.dart' show | 14 import 'compiler_context.dart' show |
| 15 CompilerContext; | 15 CompilerContext; |
| 16 | 16 |
| 17 const Map<String, dynamic> optionSpecification = const <String, dynamic>{ | 17 const Map<String, dynamic> optionSpecification = const <String, dynamic>{ |
| 18 "--compile-sdk": Uri, |
| 19 "--fatal": ",", |
| 20 "--output": Uri, |
| 21 "--packages": Uri, |
| 22 "--platform": Uri, |
| 18 "-o": Uri, | 23 "-o": Uri, |
| 19 "--output": Uri, | |
| 20 "--platform": Uri, | |
| 21 "--packages": Uri, | |
| 22 "--fatal": ",", | |
| 23 }; | 24 }; |
| 24 | 25 |
| 25 class CompilerCommandLine extends CommandLine { | 26 class CompilerCommandLine extends CommandLine { |
| 26 final String programName; | 27 final String programName; |
| 27 | 28 |
| 28 CompilerCommandLine(String programName, List<String> arguments) | 29 CompilerCommandLine(String programName, List<String> arguments) |
| 29 : programName = programName, | 30 : programName = programName, |
| 30 super(arguments, specification: optionSpecification, | 31 super(arguments, specification: optionSpecification, |
| 31 usage: computeUsage(programName, false)); | 32 usage: computeUsage(programName, false)); |
| 32 | 33 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 63 } | 64 } |
| 64 | 65 |
| 65 Uri get defaultOutput => Uri.base.resolve("${arguments.first}.dill"); | 66 Uri get defaultOutput => Uri.base.resolve("${arguments.first}.dill"); |
| 66 | 67 |
| 67 Uri get platform { | 68 Uri get platform { |
| 68 return options.containsKey("--compile-sdk") | 69 return options.containsKey("--compile-sdk") |
| 69 ? null | 70 ? null |
| 70 : options["--platform"] ?? Uri.base.resolve("platform.dill"); | 71 : options["--platform"] ?? Uri.base.resolve("platform.dill"); |
| 71 } | 72 } |
| 72 | 73 |
| 74 Uri get sdk => options["--compile-sdk"]; |
| 75 |
| 73 Set<String> get fatal { | 76 Set<String> get fatal { |
| 74 return new Set<String>.from(options["--fatal"] ?? <String>[]); | 77 return new Set<String>.from(options["--fatal"] ?? <String>[]); |
| 75 } | 78 } |
| 76 | 79 |
| 77 bool get errorsAreFatal => fatal.contains("errors"); | 80 bool get errorsAreFatal => fatal.contains("errors"); |
| 78 | 81 |
| 79 bool get warningsAreFatal => fatal.contains("warnings"); | 82 bool get warningsAreFatal => fatal.contains("warnings"); |
| 80 | 83 |
| 81 bool get nitsAreFatal => fatal.contains("nits"); | 84 bool get nitsAreFatal => fatal.contains("nits"); |
| 82 | 85 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 Read the SDK platform from <file>, which should be in Dill/Kernel IR format | 158 Read the SDK platform from <file>, which should be in Dill/Kernel IR format |
| 156 and contain the Dart SDK. | 159 and contain the Dart SDK. |
| 157 | 160 |
| 158 --verify | 161 --verify |
| 159 Check that the generated output is free of various problems. This is mostly | 162 Check that the generated output is free of various problems. This is mostly |
| 160 useful for developers of this compiler or Kernel transformations. | 163 useful for developers of this compiler or Kernel transformations. |
| 161 | 164 |
| 162 --dump-ir | 165 --dump-ir |
| 163 Print compiled libraries in Kernel source notation. | 166 Print compiled libraries in Kernel source notation. |
| 164 | 167 |
| 165 --compile-sdk | 168 --compile-sdk=<patched_sdk> |
| 166 Compile the SDK from scratch instead of reading it from 'platform.dill'. | 169 Compile the SDK from scratch instead of reading it from 'platform.dill'. |
| 167 | 170 |
| 168 --fatal=errors | 171 --fatal=errors |
| 169 --fatal=warnings | 172 --fatal=warnings |
| 170 --fatal=nits | 173 --fatal=nits |
| 171 Makes messages of the given kinds fatal, that is, immediately stop the | 174 Makes messages of the given kinds fatal, that is, immediately stop the |
| 172 compiler with a non-zero exit-code. In --verbose mode, also display an | 175 compiler with a non-zero exit-code. In --verbose mode, also display an |
| 173 internal stack trace from the compiler. Multiple kinds can be separated by | 176 internal stack trace from the compiler. Multiple kinds can be separated by |
| 174 commas, for example, --fatal=errors,warnings. | 177 commas, for example, --fatal=errors,warnings. |
| 175 """; | 178 """; |
| OLD | NEW |