Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: pkg/front_end/lib/src/fasta/compiler_command_line.dart

Issue 2878383003: Fix command line args validation for platform compilation with fasta (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, argumentError;
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 void validate() { 44 void validate() {
45 if (help) { 45 if (help) {
46 print(computeUsage(programName, verbose)); 46 print(computeUsage(programName, verbose));
47 exit(0); 47 exit(0);
48 } 48 }
49 49
50 if (options.containsKey("-o") && options.containsKey("--output")) { 50 if (options.containsKey("-o") && options.containsKey("--output")) {
51 return argumentError(usage, "Can't specify both '-o' and '--output'."); 51 return argumentError(usage, "Can't specify both '-o' and '--output'.");
52 } 52 }
53 if (programName == "compile_platform" && arguments.length != 2) { 53 if (programName == "compile_platform" && arguments.length != 3) {
54 // The three expected arguments are: patched_sdk/lib path, full output
55 // path (usually "platform.dill"), and outline output path.
54 return argumentError(usage, "Expected two arguments."); 56 return argumentError(usage, "Expected two arguments.");
ahe 2017/05/15 11:02:01 Consider removing the comment and updating the err
Dmitry Stefantsov 2017/05/15 11:07:03 Right :) Thanks!
55 } else if (arguments.isEmpty) { 57 } else if (arguments.isEmpty) {
56 return argumentError(usage, "No Dart file specified."); 58 return argumentError(usage, "No Dart file specified.");
57 } 59 }
58 } 60 }
59 61
60 Uri get output { 62 Uri get output {
61 return options["-o"] ?? options["--output"] ?? defaultOutput; 63 return options["-o"] ?? options["--output"] ?? defaultOutput;
62 } 64 }
63 65
64 Uri get defaultOutput => Uri.base.resolve("${arguments.first}.dill"); 66 Uri get defaultOutput => Uri.base.resolve("${arguments.first}.dill");
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 summary = 116 summary =
115 "Compiles a Dart program to the Dill/Kernel IR format via dartk."; 117 "Compiles a Dart program to the Dill/Kernel IR format via dartk.";
116 break; 118 break;
117 119
118 case "run": 120 case "run":
119 summary = "Runs a Dart program."; 121 summary = "Runs a Dart program.";
120 break; 122 break;
121 123
122 case "compile_platform": 124 case "compile_platform":
123 summary = "Compiles Dart SDK platform to the Dill/Kernel IR format."; 125 summary = "Compiles Dart SDK platform to the Dill/Kernel IR format.";
124 basicUsage = "Usage: $programName [options] patched_sdk output\n"; 126 basicUsage = "Usage: $programName [options] patched_sdk fullOutput "
127 "outlineOutput\n";
125 } 128 }
126 StringBuffer sb = new StringBuffer(basicUsage); 129 StringBuffer sb = new StringBuffer(basicUsage);
127 if (summary != null) { 130 if (summary != null) {
128 sb.writeln(); 131 sb.writeln();
129 sb.writeln(summary); 132 sb.writeln(summary);
130 sb.writeln(); 133 sb.writeln();
131 } 134 }
132 sb.write(options); 135 sb.write(options);
133 return "$sb"; 136 return "$sb";
134 } 137 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 Compile the SDK from scratch instead of reading it from 'platform.dill'. 181 Compile the SDK from scratch instead of reading it from 'platform.dill'.
179 182
180 --fatal=errors 183 --fatal=errors
181 --fatal=warnings 184 --fatal=warnings
182 --fatal=nits 185 --fatal=nits
183 Makes messages of the given kinds fatal, that is, immediately stop the 186 Makes messages of the given kinds fatal, that is, immediately stop the
184 compiler with a non-zero exit-code. In --verbose mode, also display an 187 compiler with a non-zero exit-code. In --verbose mode, also display an
185 internal stack trace from the compiler. Multiple kinds can be separated by 188 internal stack trace from the compiler. Multiple kinds can be separated by
186 commas, for example, --fatal=errors,warnings. 189 commas, for example, --fatal=errors,warnings.
187 """; 190 """;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698