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

Side by Side Diff: pkg/dev_compiler/lib/src/compiler/command.dart

Issue 2987393002: enable batch mode for dartdevc tests, also fix status so ddc bots pass (Closed)
Patch Set: fix Created 3 years, 4 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 | « pkg/dev_compiler/bin/dartdevc.dart ('k') | pkg/dev_compiler/test/test.sh » ('j') | 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 import 'dart:io'; 5 import 'dart:io';
6 import 'package:analyzer/src/command_line/arguments.dart' 6 import 'package:analyzer/src/command_line/arguments.dart'
7 show 7 show
8 defineAnalysisArguments, 8 defineAnalysisArguments,
9 filterUnknownArguments, 9 filterUnknownArguments,
10 ignoreUnrecognizedFlagsFlag; 10 ignoreUnrecognizedFlagsFlag;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 /// Thrown when the input source code has errors. 274 /// Thrown when the input source code has errors.
275 class CompileErrorException implements Exception { 275 class CompileErrorException implements Exception {
276 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; 276 toString() => '\nPlease fix all errors before compiling (warnings are okay).';
277 } 277 }
278 278
279 /// Thrown when force compilation failed (probably due to static errors). 279 /// Thrown when force compilation failed (probably due to static errors).
280 class ForceCompileErrorException extends CompileErrorException { 280 class ForceCompileErrorException extends CompileErrorException {
281 toString() => 281 toString() =>
282 '\nForce-compilation not successful. Please check static errors.'; 282 '\nForce-compilation not successful. Please check static errors.';
283 } 283 }
284
285 // TODO(jmesserly): fix this function in analyzer
286 List<String> filterUnknownArguments(List<String> args, ArgParser parser) {
287 Set<String> knownOptions = new Set<String>();
288 Set<String> knownAbbreviations = new Set<String>();
289 parser.options.forEach((String name, option) {
290 knownOptions.add(name);
291 String abbreviation = option.abbreviation;
292 if (abbreviation != null) {
293 knownAbbreviations.add(abbreviation);
294 }
295 });
296 List<String> filtered = <String>[];
297 for (int i = 0; i < args.length; i++) {
298 String argument = args[i];
299 if (argument.startsWith('--') && argument.length > 2) {
300 int equalsOffset = argument.lastIndexOf('=');
301 int end = equalsOffset < 0 ? argument.length : equalsOffset;
302 if (knownOptions.contains(argument.substring(2, end))) {
303 filtered.add(argument);
304 }
305 } else if (argument.startsWith('-') && argument.length > 1) {
306 // TODO(jmesserly): fix this line in analyzer
307 // It was discarding abbreviations such as -Da=b
308 // Abbreviations must be 1-character (this is enforced by ArgParser),
309 // so we don't need to use `optionName`
310 if (knownAbbreviations.contains(argument[1])) {
311 filtered.add(argument);
312 }
313 } else {
314 filtered.add(argument);
315 }
316 }
317 return filtered;
318 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/bin/dartdevc.dart ('k') | pkg/dev_compiler/test/test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698